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: package-structure-code/python-package-distribution-files-sdist-wheel.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ dependencies = [
53
53
54
54
2. When the build tool creates your package distribution file (the file that you publish on PyPI), it also creates a METADATA file which PyPI can read and use to help users find your package. For example:
55
55
56
-
- The `classifiers = ` section of your `[project]` table in the pyproject.toml file provides information that users on PyPI can use to filter for packages that contain specific licenses or that support specific versions of python.
56
+
- The `classifiers = ` section of your `[project]` table in the pyproject.toml file provides information that users on PyPI can use to filter for packages that address different topics or that support specific versions of python.
Copy file name to clipboardExpand all lines: tutorials/add-license-coc.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,13 +26,13 @@ In this lesson you will learn:
26
26
A license contains legal language about how users can use and reuse your software. To set the `LICENSE` for your project, you:
27
27
28
28
1. Create a `LICENSE` file in your project directory that specifies the license that you choose for your package.
29
-
2.Reference that file in your `pyproject.toml` data where metadata are set.
29
+
2.Describe your choice of license in your `pyproject.toml` data where metadata are set.
30
30
31
-
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.
31
+
By adding this metadata to your `pyproject.toml` file, the choice of license will be included in your package's metadata which is used to populate your package's PyPI landing page. The `LICENSE` file is also used in your GitHub repository's landing page interface.
32
32
33
33
### What license should you use?
34
34
35
-
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
35
+
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-Clause[^bsd3]). If you are unsure, use MIT given it's the generally recommended
36
36
license on [choosealicense.com](https://choosealicense.com/).
37
37
38
38
:::{admonition} Licenses for the scientific Python ecosystem
Copy file name to clipboardExpand all lines: tutorials/pyproject-toml.md
+21-17Lines changed: 21 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -272,8 +272,8 @@ you want to have listed as authors and maintainers on your PyPI landing page.
272
272
### Step 2: Add README and license
273
273
274
274
In the previous lessons, you added both a [README.md](add-readme) file and a [LICENSE](add-license-coc) to your package repository.
275
-
Once you have those files, you can add them to your pyproject.toml file as
276
-
links following the example below.
275
+
Once you have those files, you can refer to the README from your pyproject.toml file, and add a short code indicating your choice of LICENSE
276
+
following the example below.
277
277
278
278
{emphasize-lines="20-21"}
279
279
```toml
@@ -297,8 +297,15 @@ maintainers = [
297
297
{ name = "New Friend", email = "newbie@pyopensci.org" }
298
298
]
299
299
readme = "README.md"
300
-
license = {file = "LICENSE"}
300
+
license = "MIT"
301
301
```
302
+
303
+
The license entry in your pyproject.toml file must use the [license expression syntax](https://packaging.python.org/en/latest/specifications/license-expression/). Often this is a short name (with no spaces) for the license, such as "MIT", "BSD-3-Clause" or "Apache-2.0". More precisely, it must be a valid SPDX license expression, as documented in the [SPDX specification](https://spdx.github.io/spdx-spec/v2.2.2/SPDX-license-expressions/), either version 2.2 or a later compatible version.
304
+
305
+
If you have multiple licenses, or a custom license, you can also express these using a license expression.
306
+
307
+
If you want to distribute license files, or other files containing legal information, with your package, you can include these using the [`license-files`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license-files) entry, but this is not required.
308
+
302
309
### Step 3: Specify Python version with `requires-python`
303
310
304
311
Add the `requires-python` field to your `pyproject.toml``[project]` table.
@@ -337,7 +344,7 @@ maintainers = [
337
344
{ name = "New Friend", email = "newbie@pyopensci.org" }
338
345
]
339
346
readme = "README.md"
340
-
license = {file = 'LICENSE'}
347
+
license = "MIT"
341
348
requires-python = ">=3.10"
342
349
```
343
350
@@ -409,7 +416,7 @@ maintainers = [
409
416
{ name = "New Friend", email = "newbie@pyopensci.org" }
@@ -454,12 +461,11 @@ Review that list and add items below to your `pyproject.toml` file:
454
461
- development status
455
462
- intended audiences
456
463
- topic
457
-
- license and
458
464
- programming language support
459
465
460
466
The classifier key should look something like the example below. A few notes:
461
467
462
-
- Your classifier values might be different depending upon the license you have selected for your package, your intended audience, development status of your package and the Python versions that you support
468
+
- Your classifier values might be different depending upon your intended audience, development status of your package and the Python versions that you support
463
469
- You can add as many classifiers as you wish as long as you use the [designated PyPI classifier values](https://PyPI.org/classifiers/).
464
470
465
471
{emphasize-lines="26-34"}
@@ -484,7 +490,7 @@ maintainers = [
484
490
{ name = "New Friend", email = "newbie@pyopensci.org" }
0 commit comments