Skip to content

Commit 8493f03

Browse files
Merge branch 'license-pyproject' of https://github.com/lwasser/python-package-guide into license-pyproject
# Conflicts: # tutorials/add-license-coc.md # tutorials/add-readme.md # tutorials/intro.md # tutorials/pyproject-toml.md
2 parents cdfd0c6 + 9d3ea27 commit 8493f03

File tree

10 files changed

+157
-91
lines changed

10 files changed

+157
-91
lines changed

.all-contributorsrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,17 @@
450450
"review",
451451
"tutorial"
452452
]
453+
},
454+
{
455+
"login": "xmnlab",
456+
"name": "Ivan Ogasawara",
457+
"avatar_url": "https://avatars.githubusercontent.com/u/5209757?v=4",
458+
"profile": "https://xmnlab.github.io",
459+
"contributions": [
460+
"code",
461+
"review",
462+
"tutorial"
463+
]
453464
}
454465
],
455466
"contributorsPerLine": 7,

README.md

Lines changed: 2 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-43-orange.svg?style=flat-square)](#contributors-)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-44-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)
@@ -130,6 +130,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
130130
</tr>
131131
<tr>
132132
<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+
<td align="center" valign="top" width="14.28%"><a href="https://xmnlab.github.io"><img src="https://avatars.githubusercontent.com/u/5209757?v=4?s=100" width="100px;" alt="Ivan Ogasawara"/><br /><sub><b>Ivan Ogasawara</b></sub></a><br /><a href="https://github.com/pyOpenSci/python-package-guide/commits?author=xmnlab" title="Code">💻</a> <a href="https://github.com/pyOpenSci/python-package-guide/pulls?q=is%3Apr+reviewed-by%3Axmnlab" title="Reviewed Pull Requests">👀</a> <a href="#tutorial-xmnlab" title="Tutorials">✅</a></td>
133134
</tr>
134135
</tbody>
135136
</table>

documentation/repository-files/license-files.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To select your license, we suggest that you use GitHub's
4747
[Choose a License tool ](https://choosealicense.com/).
4848

4949
If you choose your license when creating a new GitHub repository, you can also
50-
automatically get a text copy of the license file to add to your repo. However
50+
automatically get a text copy of the license file to add to your repository. However
5151
in some cases the license that you want is not available through that online
5252
process.
5353

@@ -78,9 +78,9 @@ with the license that you selected for your package.
7878
:::{admonition} An example of how a license determine how code can be reused
7979
:class: note
8080

81-
Let's use stackOverflow as an example that highlights how a license determines how code can or can not be used.
81+
Let's use StackOverflow as an example that highlights how a license determines how code can or can not be used.
8282

83-
[Stack overflow uses a Creative Commons Share Alike license.](https://stackoverflow.com/help/licensing). The sharealike license requires you to use the same sharealike license when you reuse any code from stackoverflow.
83+
[Stack overflow uses a Creative Commons Share Alike license.](https://stackoverflow.com/help/licensing). The sharealike license requires you to use the same sharealike license when you reuse any code from StackOverflow.
8484

8585
This means that technically, if you copy code from the Stack Overflow website, and use it in your package. And your packages uses a different license such as a MIT license, you are violating Stack Overflow's license requirements!
8686

@@ -92,7 +92,7 @@ This means that technically, if you copy code from the Stack Overflow website, a
9292

9393
While many permissive licenses do not require citation we STRONG encourage that you cite all software that you use in papers, blogs and other publications. You tell your users how to cite your package by using a [citation.cff file](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-citation-files). We will cover this topic when we talk about creating DOI's for your package using zenodo.
9494

95-
<!-- TODO: add link when lesson is created - but also we don't yet know how citation.cff files work with zenodo (do they work??) will the citation info update with a new zenodo link
95+
<!-- TODO: add link when lesson is created - but also we don't yet know how citation.cff files work with Zenodo (do they work??) will the citation info update with a new Zenodo link
9696
9797
These files - we need to understand if that date releases auto populates or forces zenodo to modify it's citation. if it's not dynamic it could be problematic
9898
538 KB
Loading

package-structure-code/publish-python-package-pypi-conda.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ Click here for a tutorial on publishing your package to PyPI.
4848
:::
4949

5050

51-
```{tip}
51+
:::{tip}
5252
On the package build page, we discussed the [two package distribution
5353
types that you will create when making a Python package](python-package-distribution-files-sdist-wheel): SDist (packaged as a .tar.gz or .zip) and
5454
Wheel (.whl) which is really a zip file. Both of those file "bundles" will
5555
be published on PyPI when you use [a standard build tool](python-package-build-tools) to build
5656
your package.
57-
```
57+
:::
5858

5959
(about-conda)=
6060
## What is Anaconda Cloud and conda?
@@ -69,8 +69,6 @@ packages. These repositories are known as channels (discussed below).
6969
:::{admonition} A brief history of conda's evolution
7070
:class: note
7171

72-
The conda ecosystem evolved years ago to provide support for and
73-
simplify the process of managing software dependencies in scientific
7472
The conda ecosystem evolved years ago to provide support for, and
7573
simplify the process of, managing software dependencies in scientific
7674
Python projects.
@@ -156,11 +154,11 @@ to use conda to manage their local environments (which many do), you should
156154
consider publishing to both PyPI and the conda-forge channel (_more
157155
on that below_).
158156

159-
```{admonition} Additional resources
160-
* [learn more about why conda-forge was created, here](https://conda-forge.org/docs/user/introduction.html#why-conda-forge)
157+
:::{admonition} Additional resources
158+
* [learn more about why conda-forge was created, here](https://conda-forge.org/docs/user/introduction.html)
161159

162160
* [To learn more about conda terminology, check out their glossary.](https://docs.conda.io/projects/conda/en/latest/glossary.html )
163-
```
161+
:::
164162

165163
<!-- One of our packages on conda-forge https://anaconda.org/conda-forge/pandera -->
166164

@@ -171,7 +169,7 @@ we encourage you to consider doing so!
171169

172170
Once your package is on PyPI, the process to add your package to conda-forge
173171
is straight forward to do. [You can follow the detailed steps provided
174-
by the conda-forge maintainer team.](https://conda-forge.org/docs/maintainer/adding_pkgs.html#generating-the-recipe).
172+
by the conda-forge maintainer team.](https://conda-forge.org/docs/maintainer/adding_pkgs.html).
175173

176174

177175
:::{button-link} ../tutorials/publish-conda-forge.html
@@ -186,9 +184,9 @@ If you want a step by step tutorial, click here.
186184

187185
Once your package is added, you will have a feedstock repository on GitHub with your packages name
188186

189-
```{tip}
187+
:::{tip}
190188
[Here is an example conda-forge feedstock for the pyOpenSci approved package - movingpandas](https://github.com/conda-forge/movingpandas-feedstock)
191-
```
189+
:::
192190

193191
### Maintaining your conda-forge package repository
194192

tutorials/add-license-coc.md

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,25 @@ In this lesson you will learn:
1616
3. How you can use the Contributors Covenant website to add generic language as a starting place for your `CODE_OF_CONDUCT`.
1717
:::
1818

19-
## Add a LICENSE file to your project directory
19+
## What is a license?
2020

21-
A license contains legal language about how users can use and reuse your software. You should include a LICENSE file in your project directory that specifies the license that you choose for your package.
21+
A license contains legal language about how users can use and reuse your software. To set the LICENSE for your project, you:
22+
23+
1. create LICENSE file in your project directory that specifies the license that you choose for your package and
24+
2. reference that file in your pyproject.toml data where metadata are set.
25+
26+
By adding the LICENSE file to your pyproject.toml file, the LICENSE will be included in your package's metadata which is used to populate your package's PyPI landing page. The LICENSE is also used in your GitHub repository's landing page interface.
27+
28+
### What license should you use?
2229

2330
We suggest that you use a permissive license that accommodates the other most commonly used licenses in the scientific Python ecosystem (MIT[^mit] and BSD-3[^bsd3]). If you are unsure, use MIT given it's the generally recommended
2431
license on [choosealicense.com](https://choosealicense.com/).
2532

2633
:::{admonition} Licenses for the scientific Python ecosystem
27-
[We discuss licenses for the scientific Python ecosystem in more detail here in our guidebook.](permissive-license)
34+
[We discuss licenses for the scientific Python ecosystem in more detail here in our guidebook.](../documentation/repository-files/license-files)
2835
:::
2936

30-
### Where should the LICENSE file live & how do you add it?
37+
### Where should the LICENSE file live
3138

3239
Your `LICENSE` file should be placed at the root of your package's repository.
3340
When you add the LICENSE at the root, GitHub will automagically discover it and
@@ -43,7 +50,10 @@ the license that SunPy uses. These files are discovered by GitHub because they
4350
are placed in the root of the project directory using standard naming conventions.
4451
:::
4552

46-
There are several ways to add a license file:
53+
54+
### How to add a LICENSE file to your package directory
55+
56+
There are several ways to add a LICENSE file:
4757

4858
1. When you create a new repository on GitHub, it will ask you if you wish to add a `LICENSE` file at that time. If you select yes, it will create the file for you.
4959
2. You can add a license through the GitHub gui following the [<i class="fa-brands fa-github"></i> instructions here](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository).
@@ -60,11 +70,11 @@ then you already have a **LICENSE** file containing text for the MIT license in
6070
If you don't yet have a **LICENSE** file in your directory, then continue reading.
6171
:::
6272

63-
### How to add a LICENSE to your existing GitHub repository
73+
### How to add a LICENSE to your package - the manual way
6474

6575
If you don't already have a LICENSE file, and you are not yet using a platform such as GitHub or GitLab, then you can create a license file by
6676

67-
1. Create a new file called LICENSE. If you are using a shell you can use:
77+
1. Create a new file called LICENSE. If you are using shell you can type:
6878

6979
```
7080
# Create a license file in your shell
@@ -75,6 +85,7 @@ If you don't already have a LICENSE file, and you are not yet using a platform s
7585
2. Select permissive license
7686
3. It will suggest that you use the [MIT license](https://choosealicense.com/licenses/mit/).
7787
4. Copy the license text that it provides into your LICENSE file that you created above.
88+
5. Save your file. You're all done!
7889

7990
:::{admonition} An overview of LICENSES in the scientific Python ecosystem
8091
:class: note
@@ -96,52 +107,67 @@ through the GitHub interface.
96107

97108
:::{figure-md} github-new-repo
98109

99-
<img src="../images/tutorials/github-new-repo.png" alt="Screenshot of the create new repository interface that GitHub provides. The elements of this are the owner and repository name for the new repo. Below that you can add a description of the repo. Below that you can set it to be public or private. At the bottom of the interface there is an Add a README checkbox where it will add a blank readme file for you. At the very bottom there is a line to add a .gitignore file and another to choose a license." width="500px">
110+
<img src="../images/tutorials/github-new-repo.png" alt="Screenshot of the create new repository interface that GitHub provides. The elements of this are the owner and repository name for the new repo. Below that you can add a description of the repository. Below that you can set it to be public or private. At the bottom of the interface there is an Add a README checkbox where it will add a blank readme file for you. At the very bottom there is a line to add a .gitignore file and another to choose a license." width="500px">
100111

101112
Image showing the GitHub interface that allows you to add a LICENSE and README file when you create a new repository.
102113
:::
103114
::::
104115

105116
::::{tab-item} Add License: Existing GitHub repository
106117

107-
If you already have a GitHub repository for your package, then you can add a LICENSE using the GitHub interface by adding a new file to the repo.
118+
If you already have a GitHub repository for your package, then you can add a LICENSE using the GitHub interface by adding a new file to the repository.
108119

109120
- Follow the instructions to select and add a license to your repository on the [GitHub LICENSE page](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository) .
110121
- Once you have added your LICENSE file, be sure to sync your git local repository with the repository on GitHub.com. This means running `git pull` to update your local branch.
111122

112123
:::{figure-md} view-license
113-
<img src="../images/tutorials/view-license-github.png" alt="sdfsdfsd nasdfjsdf" width="500px">
124+
<img src="../images/tutorials/view-license-github.png" alt="Image showing what the LICENSE file looks like in the GItHub interface. At the top you can see the actual license which in this image is BSD 3-clause New or revised license. Then there is some text describing both what the license is and the associated permissions for that specific license. At the bottom of the image, the actual text for the license is shown in the LICENSE file." width="500px">
114125

115-
You can also view a summary of the license on its GitHub landing page.```
126+
You can view a summary of the LICENSE chosen on your project's
127+
GitHub landing page.
116128
:::
117129
::::
118130

119131
:::::
120132
::::::
121133

134+
Now you know how to add a LICENSE to your project. Next, you'll learn
135+
about the `CODE_OF_CONDUCT.md` file and how to add it to your
136+
package directory.
137+
122138
(add-coc)=
123-
## Add a CODE_OF_CONDUCT file to your repo
139+
## What is a code of conduct file?
124140

125-
Now that you have added a LICENSE to your project, you are ready to add a `CODE_OF_CONDUCT.md` to your package directory. The `CODE_OF_CONDUCT.md` should be placed at the root of your project directory, similar to the LICENSE file,.
141+
A `CODE_OF_CONDUCT` file is used to establish guidelines for how people in your community interact.
126142

127-
A `CODE_OF_CONDUCT` file is critical to supporting your community as it
143+
This file is critical to supporting your community as it
128144
grows. The `CODE_OF_CONDUCT`:
129145

130146
1. Establishes guidelines for how users and contributors interact with each other and you in your software repository.
131147
2. Identifies negative behaviors that you don't want in your interactions.
132148

133149
You can use your code of conduct as a tool that can be referenced when moderating challenging conversations.
134150

151+
### What to put in your code of conduct file
152+
135153
If you are unsure of what language to add to your `CODE_OF_CONDUCT`
136154
file, we suggest that you adopt the [contributor covenant language](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) as a starting place.
137155

138156
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](#)
139157

140-
### Add your CODE_OF_CONDUCT file
158+
The `CODE_OF_CONDUCT.md` should be placed at the root of your project directory, similar to the LICENSE file.
141159

142-
- Add a `CODE_OF_CONDUCT.md` file to your repository if it doesn't
143-
already exist.
144-
- Visit the [contributor covenant website](https://www.contributor-covenant.org/) and add [the markdown version of their code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) to your `CODE_OF_CONDUCT.md` file.
160+
### How to add a CODE_OF_CONDUCT file to your package directory
161+
162+
- Add a `CODE_OF_CONDUCT.md` file to the root of your repository if it doesn't already exist.
163+
164+
```bash
165+
> touch CODE_OF_CONDUCT.md
166+
```
167+
168+
- Visit the [contributor covenant website](https://www.contributor-covenant.org/) and add [the markdown version of their code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) to your `CODE_OF_CONDUCT.md` file. Read the text closely to ensure you both understand it and also agree with its contents!
169+
170+
That's it - you've now added a code of conduct to your package directory.
145171

146172
:::{admonition} Additional Code of Conduct resources
147173
:class: note
@@ -161,11 +187,11 @@ In this lesson and the [last lesson](add-readme), you have added a:
161187

162188
These are fundamental files needed for every scientific Python package
163189
repository. These files help users understand how to use your package and
164-
interact with package maintainers. In the upcoming
165-
lessons, you will:
190+
interact with package maintainers.
191+
192+
In the upcoming lessons, you will:
166193

167-
- [Flesh out your `pyproject.toml` file](pyproject-toml) to support building
168-
and publishing your package on PyPI.
194+
- [Add more metadata to your `pyproject.toml` file](pyproject-toml) to support building and publishing your package on PyPI.
169195
- Publish a new version of your Python package to (Test) PyPI to preview the
170196
updated metadata landing page.
171197

0 commit comments

Comments
 (0)