You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/repository-files/license-files.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ To select your license, we suggest that you use GitHub's
47
47
[Choose a License tool ](https://choosealicense.com/).
48
48
49
49
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
51
51
in some cases the license that you want is not available through that online
52
52
process.
53
53
@@ -78,9 +78,9 @@ with the license that you selected for your package.
78
78
:::{admonition} An example of how a license determine how code can be reused
79
79
:class: note
80
80
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.
82
82
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.
84
84
85
85
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!
86
86
@@ -92,7 +92,7 @@ This means that technically, if you copy code from the Stack Overflow website, a
92
92
93
93
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.
94
94
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
96
96
97
97
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
Copy file name to clipboardExpand all lines: tutorials/add-license-coc.md
+23-11Lines changed: 23 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -16,18 +16,25 @@ In this lesson you will learn:
16
16
3. How you can use the Contributors Covenant website to add generic language as a starting place for your `CODE_OF_CONDUCT`.
17
17
:::
18
18
19
-
## Add a LICENSE file to your project directory
19
+
## What is a license and why is it important?
20
20
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. It is also used in your GitHub repository (see image below).
27
+
28
+
### What license should you use?
22
29
23
30
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
24
31
license on [choosealicense.com](https://choosealicense.com/).
25
32
26
33
:::{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)
28
35
:::
29
36
30
-
### Where should the LICENSE file live & how do you add it?
37
+
### Where should the LICENSE file live
31
38
32
39
Your `LICENSE` file should be placed at the root of your package's repository.
33
40
When you add the LICENSE at the root, GitHub will automagically discover it and
@@ -43,11 +50,15 @@ the license that SunPy uses. These files are discovered by GitHub because they
43
50
are placed in the root of the project directory using standard naming conventions.
44
51
:::
45
52
46
-
There are several ways to add a license file:
53
+
54
+
## How to add a LICENSE file to your package repository
55
+
56
+
There are several ways to add a LICENSE file:
47
57
48
58
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.
49
59
2. You can add a license through the GitHub gui following the [<iclass="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).
50
60
3. You can add the file manually like we are doing in this lesson.
61
+
4. Or, if you are using a tool such as Hatch, it will add a LICENSE file for you.
51
62
52
63
:::{tip}
53
64
If you completed the past lessons including
@@ -60,7 +71,7 @@ then you already have a **LICENSE** file containing text for the MIT license in
60
71
If you don't yet have a **LICENSE** file in your directory, then continue reading.
61
72
:::
62
73
63
-
### How to add a LICENSE to your existing GitHub repository
74
+
### Add a LICENSE to your existing GitHub repository
64
75
65
76
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
66
77
@@ -96,31 +107,32 @@ through the GitHub interface.
96
107
97
108
:::{figure-md} github-new-repo
98
109
99
-
<imgsrc="../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
+
<imgsrc="../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">
100
111
101
112
Image showing the GitHub interface that allows you to add a LICENSE and README file when you create a new repository.
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.
108
119
109
120
- 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) .
110
121
- 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.
<imgsrc="../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">
114
125
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.
116
128
:::
117
129
::::
118
130
119
131
:::::
120
132
::::::
121
133
122
134
(add-coc)=
123
-
## Add a CODE_OF_CONDUCT file to your repo
135
+
## Add a CODE_OF_CONDUCT file to your repository
124
136
125
137
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,.
Copy file name to clipboardExpand all lines: tutorials/add-readme.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -62,7 +62,7 @@ If you are using markdown it should be a header 1 tag which is denoted with a si
62
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
63
64
64
* Broken documentation and test builds.
65
-
* Versions of your package that are on PyPI and Conda.
65
+
* Versions of your package that are on PyPI and conda.
66
66
* Whether your package has been reviewed and vetted by an organization such as pyOpenSci and/or JOSS.
67
67
68
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.
Copy file name to clipboardExpand all lines: tutorials/intro.md
+6-7Lines changed: 6 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Get to know Hatch <get-to-know-hatch>
33
33
34
34
:::{toctree}
35
35
:hidden:
36
-
:caption: Create a Python Package
36
+
:caption: Create and publish a Python Package
37
37
38
38
What is a Python package? <self>
39
39
Make your code installable <1-installable-code>
@@ -43,11 +43,11 @@ Publish to conda-forge <publish-conda-forge>
43
43
44
44
:::{toctree}
45
45
:hidden:
46
-
:caption: Citation, License & Project metadata
46
+
:caption: Project information files & metadata
47
47
48
48
Add README file <add-readme>
49
-
Add a license & COC <add-license-coc>
50
-
Update metadata <pyproject-toml>
49
+
Add a license & code of conduct <add-license-coc>
50
+
Update metadata in pyproject.toml <pyproject-toml>
51
51
:::
52
52
53
53
:::{admonition} Learning Objectives
@@ -98,7 +98,6 @@ to manage and reuse your code across different projects.
98
98
Structuring your code as a package is the first step you need to take so you can share the tools in the toolbox you've created and let others build with it.
99
99
100
100
(package-benefits)=
101
-
102
101
## Why create a Python package?
103
102
104
103
You might create a Python package because you want to:
@@ -293,7 +292,7 @@ allows you to access it from any code run with that specific Python environment
293
292
294
293
:::{figure-md} packages-environment
295
294
296
-
<imgsrc="../images/tutorials/environment-package-install.png"alt="Diagram showing the steps associated with creating a package and then installing it. The first arrow says your package and the second says pip install package. The second arrow leads to a box that represents a Python environment that already has some packages installed such as pandas and NumPy. Your package will also get installed into that same environment when you pip install it."width="700px">
295
+
<imgsrc="../images/tutorials/environment-package-install.png"alt="Diagram showing the steps associated with creating a package and then installing it. The first arrow says your package and the second says pip install package. The second arrow leads to a box that represents a Python environment that already has some packages installed such as Pandas and NumPy. Your package will also get installed into that same environment when you pip install it."width="700px">
297
296
298
297
You don't have to publish to PyPI to make your code installable.
299
298
With the correct file structure and project metadata you can make your code
@@ -320,7 +319,7 @@ Then you can create a conda-forge recipe using the [Grayskull](https://github.co
320
319
<imgsrc="../images/tutorials/publish-package-pypi-conda.png"alt="Graphic showing the high level packaging workflow. On the left you see a graphic with code, metadata and tests in it. Those items all go into your package. Documentation and data are below that box because they aren't normally published in your packaging wheel distribution. an arrow to the right takes you to a build distribution files box. that box leads you to either publishing to testPyPI or the real PyPI. From PyPI you can then connect to conda-forge for an automated build that sends distributions from PyPI to conda-forge."width="700px">
321
320
322
321
In the image above, you can see the steps associated with publishing
323
-
your package on PyPI and conda-forge. Note that the distribution files that PyPI requires are the [sdist](#python-source-distribution) and [wheel](#python-wheel) files. Once you are ready to make your code publicly installable, you can publish it on PyPI. Once your code is on PyPI it is straight forward to then publish to conda-forge. You create a recipe using the Grayskull package and then you open a pr in the conda-forge recipe repo. You will learn more about this process in the [conda-forge lesson](#).
322
+
your package on PyPI and conda-forge. Note that the distribution files that PyPI requires are the [sdist](#python-source-distribution) and [wheel](#python-wheel) files. Once you are ready to make your code publicly installable, you can publish it on PyPI. Once your code is on PyPI it is straight forward to then publish to conda-forge. You create a recipe using the Grayskull package and then you open a pr in the conda-forge recipe repository. You will learn more about this process in the [conda-forge lesson](#).
0 commit comments