Skip to content

Commit a5122e9

Browse files
authored
Merge branch 'main' into conda-force
2 parents b46abde + 163000a commit a5122e9

File tree

4 files changed

+255
-2
lines changed

4 files changed

+255
-2
lines changed

.all-contributorsrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,17 @@
439439
"review",
440440
"tutorial"
441441
]
442+
},
443+
{
444+
"login": "h-vetinari",
445+
"name": "h-vetinari",
446+
"avatar_url": "https://avatars.githubusercontent.com/u/33685575?v=4",
447+
"profile": "https://github.com/h-vetinari",
448+
"contributions": [
449+
"code",
450+
"review",
451+
"tutorial"
452+
]
442453
}
443454
],
444455
"contributorsPerLine": 7,

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# <img src="https://www.pyopensci.org/images/logo.png" width=100 /> pyOpenSci scientific Python Packaging Guide
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-42-orange.svg?style=flat-square)](#contributors-)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-43-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55

66
![GitHub release (latest by date)](https://img.shields.io/github/v/release/pyopensci/python-package-guide?color=purple&display_name=tag&style=plastic)
@@ -128,6 +128,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
128128
<td align="center" valign="top" width="14.28%"><a href="http://jacksonwarnerburns.com"><img src="https://avatars.githubusercontent.com/u/33505528?v=4?s=100" width="100px;" alt="Jackson Burns"/><br /><sub><b>Jackson Burns</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=JacksonBurns" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3AJacksonBurns" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-JacksonBurns" title="Tutorials">✅</a></td>
129129
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jaimergp"><img src="https://avatars.githubusercontent.com/u/2559438?v=4?s=100" width="100px;" alt="jaimergp"/><br /><sub><b>jaimergp</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=jaimergp" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Ajaimergp" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-jaimergp" title="Tutorials">✅</a></td>
130130
</tr>
131+
<tr>
132+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/h-vetinari"><img src="https://avatars.githubusercontent.com/u/33685575?v=4?s=100" width="100px;" alt="h-vetinari"/><br /><sub><b>h-vetinari</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=h-vetinari" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Ah-vetinari" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-h-vetinari" title="Tutorials">✅</a></td>
133+
</tr>
131134
</tbody>
132135
</table>
133136

tutorials/add-readme.md

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# Add a README file to your Python package
2+
3+
In the previous lessons you learned:
4+
5+
1. What a Python package is
6+
2. How to make your code installable
7+
3. How to publish your package to (test) PyPI
8+
9+
:::{admonition} Learning objectives
10+
11+
In this lesson you will learn:
12+
13+
1. How to add a **README.md** file to your package.
14+
2. What the core elements of a **README.md** file are.
15+
:::
16+
17+
## What is a README file?
18+
19+
The `README.md` file is a markdown file located at the root of your project directory that helps
20+
a user understand:
21+
22+
- You package's name
23+
- What the package does. Your README file should clearly state the problem(s) that your software is designed to solve and its target audience.
24+
- The current development "state" of the package (through badges)
25+
- How to get started with using your package.
26+
- How to contribute to your package
27+
- How to cite your package
28+
29+
Your **README.md** file is important as it is often the first thing that someone sees before they install your package. The README file also will be used to populate your PyPI landing page.
30+
31+
Note that there is no required format for README files. This page simply outlines sections that we suggest you have in your README file.
32+
33+
## Create a README.md file for your package
34+
35+
It's time to add a `README.md` file to your project directory.
36+
37+
### Step 0. Create a README file
38+
To get started, if you don't already have a README.md file in your project directory, create one.
39+
40+
:::{tip}
41+
If you created your project directory from
42+
43+
* a GitHub repository online
44+
* using `hatch init`
45+
46+
Then you may already have a README.MD file in your project directory.
47+
:::
48+
49+
<!-- If they use hatch init in the very first lesson -
50+
the readme will already be there-->
51+
52+
### Step 1. Add the name of your package as the README title
53+
54+
At the top of the `README.md` file, add the name of your package.
55+
56+
If you are using markdown it should be a header 1 tag which is denoted with a single `#` sign.
57+
58+
`# Package-title-here`
59+
60+
### Step 2 - add badges to the top of your README file
61+
62+
It's common for maintainers to add badges to the top of their README files. Badges allow you and your package users to track things like
63+
64+
* Broken documentation and test builds.
65+
* Versions of your package that are on PyPI and Conda.
66+
* Whether your package has been reviewed and vetted by an organization such as pyOpenSci and/or JOSS.
67+
68+
If you have already published your package to pypi.org you can use [shields.io to create a package version badge](https://shields.io/badges/py-pi-version). This badge will dynamically update as you release new versions of your package to PyPI.
69+
70+
If not, you can leave the top empty for now and add badges to your README at a later point as they make sense for your package.
71+
72+
### Step 3 - Add a description of what your package does
73+
74+
Below the badges (if you have them), add a section of text
75+
that provides an easy-to-understand overview of what your
76+
package does.
77+
78+
* Keep this section short.
79+
* Try to avoid jargon.
80+
* Define technical terms that you use to make the description accessible to more people.
81+
82+
Remember that the more people understand what your package does, the more people will use it.
83+
84+
### Step 4 - Add package installation instructions
85+
86+
Next, add instructions that tell users how to install your package.
87+
88+
For example, can they use pip to install your package?
89+
`pip install packagename`
90+
91+
or conda?
92+
93+
`conda install -c conda-forge packagename`.
94+
95+
If you haven't yet published your package to pypi.org then
96+
you can skip this section and come back and add these
97+
instructions later.
98+
99+
### Step 5 - Any additional setup
100+
101+
In some cases, your package users may need to manually
102+
install other tools in order to use your package. If that
103+
is the case, be sure to add a section on additional setup
104+
to your README file.
105+
106+
Here, briefly document (or link to documentation for) any
107+
additional setup that is required to use your package.
108+
This might include:
109+
110+
* authentication information, if it is applicable to your package.
111+
* additional tool installations, such as GDAL.
112+
113+
:::{note}
114+
Many packages won't need this section in their README. In that case you can always skip this section!
115+
:::
116+
117+
118+
### Step 6 - Add a get started section
119+
120+
Next add a getting started section that shows how to use your package. This
121+
section should include a small code snippet that demonstrates importing and using
122+
some of the functionality in your package.
123+
124+
:::{admonition} Provide a fully functional code snippet if possible
125+
:class: important
126+
127+
It is important to try to make the code examples that you provide your users as useful as possible.
128+
129+
Be sure to provide a copy/paste code example that will work as-is when pasted into a Jupyter Notebook or .py file if that is possible.
130+
131+
If there are tokens and other steps needed to run your package, be sure to be clear about what those steps entail.
132+
:::
133+
134+
For the pyosPackage, a short get started demo might look like this:
135+
136+
```python
137+
>>> from pyospackage.add_numbers import add_num
138+
>>> add_num(1, 2)
139+
3
140+
```
141+
142+
Or it could simply be a link to a getting started tutorial that you have created. If
143+
you don't have this yet, you can leave it empty for the time being.
144+
145+
This would
146+
also be a great place to add links to any tutorials that you have created that
147+
help users understand how to use your package for common workflows.
148+
149+
150+
### Step 7 - Community section
151+
152+
The community section of your README file is a place to include information for users who may want to engage with your project. This engagement will likely happen on a platform like GitHub or GitLab.
153+
154+
In the community section, you will add links to your contributing guide
155+
and `CODE_OF_CONDUCT.md`. You will add a [`CODE_OF_CONDUCT.md` file in the next lesson](add-license-coc).
156+
157+
As your package grows you may also have a link to a development guide that contributors and your maintainer team will follow.
158+
159+
160+
161+
### Step 8 - Citation information
162+
163+
Finally it is important to let users know how to cite your package.
164+
You can communicate citation information in a few different ways.
165+
166+
You can use a tool such as zenodo to create a DOI and associated citation
167+
information for your package if it is hosted on a platform such as
168+
GitHub. [Check out this short tutorial that covers setting that up.](https://coderefinery.github.io/github-without-command-line/doi/)
169+
170+
Alternatively if you send your package through a peer review process such
171+
as the [one lead by pyOpenSci](https://www.pyopensci.org/about-peer-review/index.html), then you can get a cross-ref DOI through our partnership
172+
with the Journal of Open Source Software.
173+
174+
## The finished README file
175+
176+
Your finished `README.md` file should look something like this:
177+
178+
````markdown
179+
# pyosPackage
180+
181+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8365068.svg)](https://doi.org/10.5281/zenodo.8365068)
182+
[![pyOpenSci](https://tinyurl.com/y22nb8up)](https://github.com/pyOpenSci/software-review/issues/115)
183+
184+
## What pyosPackage does
185+
186+
Short description here using non-technical language that describes what your package does.
187+
188+
## How to install pyosPackage
189+
190+
<todo - when i add more to the pyos package this can use that readme>
191+
To install this package run:
192+
193+
`pip install pyosPackage`
194+
195+
## OPTIONAL - if you have additional setup instructions add them here. if not, skip this section.
196+
197+
## Get started using pyosPackage
198+
199+
Here add a quick code demo showing a user how to use the package after it is installed.
200+
201+
```python
202+
>>> from pyospackage.add_numbers import add_num
203+
>>> add_num(1, 2)
204+
3
205+
206+
```
207+
208+
You can also add any links to tutorials in your documentation here.
209+
210+
## Community
211+
212+
Add information here about contributing to your package. Be sure to add links to your `CODE_OF_CONDUCT.md` file and your development guide. For now this section might be empty. You can go back and fill it in later.
213+
214+
## How to cite pyosPackage
215+
216+
citation information here
217+
218+
## <i class="fa-solid fa-hands-bubbles"></i> Wrap up
219+
220+
It's important to consider the information that a new user or contributor might
221+
need when creating your `README.md` file. While there is no perfect template,
222+
above is a set of recommendations as you are just getting started. You may find
223+
the need for other elements to be added to this file as you further develop your
224+
package and as a community begins to use your package.
225+
226+
In the [next lesson](add-license-coc), you will add a LICENSE file to
227+
your Python package. A license file is critical as it tells users
228+
how they legally can (and can't) use your package. It also:
229+
230+
* Builds trust with your users
231+
* Discourages misuse of your package and associated code

tutorials/intro.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Get to know Hatch <get-to-know-hatch>
4343

4444
:::{toctree}
4545
:hidden:
46-
:caption: Python Packaging 101
46+
:caption: Create a Python package
4747

4848
What is a Python package? <self>
4949
Make your code installable <1-installable-code>
@@ -52,6 +52,13 @@ Publish to conda-forge <publish-conda-forge>
5252
:::
5353

5454

55+
:::{toctree}
56+
:hidden:
57+
:caption: Project Metadata
58+
59+
Add README file <add-readme>
60+
:::
61+
5562
:::{admonition} Learning Objectives
5663

5764
This lesson introduces you to the basic components of a Python package.
@@ -312,6 +319,7 @@ publish it in a repository such as **PyPI** or **conda-forge**.
312319

313320
Learn [how to publish your package to PyPI in this tutorial.](publish-pypi.md)
314321

322+
You will learn [how to publish your package to PyPI in this tutorial.](publish-pypi)
315323

316324
Then you can create a conda-forge recipe using the [Grayskull](https://github.com/conda/grayskull) tool. You can then submit this recipe to conda-forge.
317325

0 commit comments

Comments
 (0)