Skip to content

Commit 8afe183

Browse files
committed
Add: last files for bug bash
1 parent 53bb587 commit 8afe183

File tree

4 files changed

+700
-2
lines changed

4 files changed

+700
-2
lines changed

images/tutorials/github-new-repo.png

527 KB
Loading

tutorials/add-license-coc.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Add a LICENSE & CODE_OF_CONDUCT to your Python package
2+
3+
In the [previous lesson](add-readme) you:
4+
5+
<i class="fa-solid fa-circle-check" style="color: #703c87;"></i> Created a basic `README.md` file for your scientific Python package
6+
7+
<i class="fa-solid fa-circle-check" style="color: #703c87;"></i> Learned about the core components that are useful to have in a README file.
8+
9+
:::{admonition} Learning objectives
10+
:class: tip
11+
12+
In this lesson you will learn:
13+
14+
1. How to select and add a `LICENSE` file to your package repository with a focus on the GitHub interface.
15+
2. How to add a `CODE_OF_CONDUCT` file to your package repository.
16+
3. How you can use the Contributors Covenant website to add generic language as a starting place for your `CODE_OF_CONDUCT`.
17+
:::
18+
19+
## Add a LICENSE file to your project directory
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.
22+
23+
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]).
24+
25+
:::{admonition} Licenses for the scientific Python ecosystem
26+
[We discuss licenses for the scientific Python ecosystem in more detail here in our guidebook.](permissive-license)
27+
:::
28+
29+
### Where should the LICENSE file live & how do you add it?
30+
31+
Your `LICENSE` file should be placed at the root of your package's repository.
32+
33+
There are several ways to add a license file:
34+
35+
1. When you create a new repository on GitHub, it will ask you if you wish to add a `LICENSE` file at that time. It will also create the file for you.
36+
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).
37+
3. You can add the file manually like we are doing in this lesson.
38+
39+
:::{tip}
40+
If you completed the past lessons including
41+
42+
1. [Making your code installable](1-installable-code.md) and
43+
2. [publishing your package to PyPI](publish-pypi.md)
44+
45+
then you already have a **LICENSE** file containing text for the MIT license in your Python package. Thus you can skip to the next section of this tutorials which walks you through adding a CODE_OF_CONDUCT.
46+
47+
If you don't yet have a **LICENSE** file in your directory, then continue reading.
48+
:::
49+
50+
### How to add a LICENSE to your existing GitHub repository
51+
52+
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
53+
54+
1. Create a new file called LICENSE. If you are using shell you can use:
55+
56+
```
57+
# Create a license file in your shell
58+
> touch LICENSE
59+
```
60+
1. Go to [choosealicense.com](https://choosealicense.com/)
61+
2. Select permissive license
62+
3. It will suggest that you use the [MIT license](https://choosealicense.com/licenses/mit/).
63+
4. Copy the license text that it provides into your LICENSE file that you created above.
64+
65+
:::{admonition} An overview of LICENSES in the scientific Python ecosystem
66+
:class: note
67+
68+
In the pyOpenSci [packaging guidebook](../documentation/repository-files/license-files), we provide an overview of license in the scientific Python ecosystem. We review why license files are important, which ones are most commonly used for scientific software and how to select the correct license.
69+
70+
If you want a broad overview of why licenses are important for protecting open source software, [check out this blog post that overviews the legal side of things.](https://opensource.guide/legal/#just-give-me-the-tldr-on-what-i-need-to-protect-my-project)
71+
:::
72+
73+
74+
::::::{dropdown} Instructions for adding a license files within the GitHub interface
75+
:color: primary
76+
77+
:::::{tab-set}
78+
79+
::::{tab-item} Add license: new GitHub repository
80+
81+
When you create a new GitHub repository you can add a license
82+
through the GitHub interface.
83+
84+
:::{figure-md} github-new-repo
85+
86+
<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">
87+
88+
Image showing the GitHub interface that allows you to add a LICENSE and README file when you create a new repository.
89+
:::
90+
::::
91+
92+
93+
::::{tab-item} Add License: Existing GitHub repository
94+
95+
If you already have a GitHub repo for your package, then you can add a LICENSE using the GitHub interface by adding a new file to the repo.
96+
97+
* 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) .
98+
* 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.
99+
100+
:::{figure-md} view-license
101+
<img src="../images/tutorials/view-license-github.png" alt="sdfsdfsd nasdfjsdf" width="500px">
102+
103+
You can also view an overview of the license on GitHub if you view it in the GitHub interface.
104+
:::
105+
::::
106+
107+
:::::
108+
::::::
109+
110+
(add-coc)=
111+
## Add a CODE_OF_CONDUCT file to your repo
112+
113+
Now that you have added a LICENSE to your project, you are ready to add a file called `CODE_OF_CONDUCT.md` to your package directory. A `CODE_OF_CONDUCT` file is critical to supporting your community as it
114+
grows. The `CODE_OF_CONDUCT`:
115+
116+
1. Establishes guidelines for how users and contributors interact with each other and you in your software repository.
117+
2. Identifies negative behaviors that you don't want in your interactions.
118+
119+
You can use your code of conduct as a tool that can be referenced when moderating challenging conversations.
120+
121+
If you are unsure of what language to add to your `CODE_OF_CONDUCT`
122+
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.
123+
124+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](#)
125+
126+
127+
### Add your CODE_OF_CONDUCT file
128+
129+
* Add a `CODE_OF_CONDUCT.md` file to your repository if it doesn't
130+
already exist.
131+
* 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.
132+
133+
134+
:::{admonition} Additional Code of Conduct resources
135+
:class: note
136+
137+
* [<i class="fa-brands fa-github"></i> Guide: `CODE_OF_CONDUCT.md` files](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project)
138+
* [pyOpenSci package guide `CODE_OF_CONDUCT.md` overview](https://www.pyopensci.org/python-package-guide/documentation/repository-files/code-of-conduct-file.html)
139+
140+
:::
141+
142+
## <i class="fa-solid fa-hands-bubbles"></i> Wrap up
143+
144+
In this lesson and the [last lesson](add-readme), you have added a:
145+
146+
* `README` file;
147+
* `LICENSE` file and a
148+
* `CODE_OF_CONDUCT` file.
149+
150+
These are core files needed for every scientific Python package. In the upcoming
151+
lessons, you will:
152+
153+
* [Flesh out your `pyproject.toml` file](pyproject-toml) to support building
154+
and publishing your package on PyPI.
155+
* Publish a new version of your Python package to (Test) PyPI to preview the
156+
updated metadata landing page.
157+
158+
159+
****
160+
161+
## Footnotes
162+
163+
[^mit]: https://opensource.org/license/mit/
164+
[^bsd3]: https://opensource.org/license/bsd-3-clause/

tutorials/intro.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Get to know Hatch <get-to-know-hatch>
3333

3434
:::{toctree}
3535
:hidden:
36-
:caption: Create a Python package
36+
:caption: Create a Python Package
3737

3838
What is a Python package? <self>
3939
Make your code installable <1-installable-code>
@@ -43,9 +43,11 @@ Publish to conda-forge <publish-conda-forge>
4343

4444
:::{toctree}
4545
:hidden:
46-
:caption: Project Metadata
46+
:caption: Citation, License & Project metadata
4747

4848
Add README file <add-readme>
49+
Add a license & COC <add-license-coc>
50+
Update metadata <pyproject-toml>
4951
:::
5052

5153
:::{admonition} Learning Objectives

0 commit comments

Comments
 (0)