Skip to content

Commit 32e6cc3

Browse files
authored
Merge pull request #564 from tomalrussell/fix/license-classifiers
Remove "License :: ..." classifiers from pyproject.toml examples
2 parents fac7f3b + 89a2332 commit 32e6cc3

File tree

9 files changed

+28
-28
lines changed

9 files changed

+28
-28
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ Classifiers are just a list of plain strings
383383
```toml
384384
classifiers = [
385385
"Programming Language :: Python :: 3",
386-
"License :: OSI Approved :: BSD License",
387386
"Operating System :: OS Independent",
388387
]
389388
```

examples/extension-hatch/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ maintainers = [
1616
description = "An example Python package used to support Python packaging tutorials"
1717
keywords = ["pyOpenSci", "python packaging"]
1818
readme = "README"
19+
license = "BSD-3-Clause"
1920
classifiers = [
2021
"Programming Language :: Python :: 3",
21-
"License :: OSI Approved :: BSD License",
2222
"Operating System :: OS Independent",
2323
]

examples/pure-hatch/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ maintainers = [
1313
description = "An example Python package used to support Python packaging tutorials"
1414
keywords = ["pyOpenSci", "python packaging"]
1515
readme = "README.md"
16+
license = "BSD-3-Clause"
1617
classifiers = [
1718
"Programming Language :: Python :: 3",
18-
"License :: OSI Approved :: BSD License",
1919
"Operating System :: OS Independent",
2020
]
2121
dependencies = [

examples/pure-setuptools/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ maintainers = [
1313
description = "An example Python package used to support Python packaging tutorials"
1414
keywords = ["pyOpenSci", "python packaging"]
1515
readme = "README.md"
16+
license = "BSD-3-Clause"
1617
classifiers = [
1718
"Programming Language :: Python :: 3",
18-
"License :: OSI Approved :: BSD License",
1919
"Operating System :: OS Independent",
2020
]
2121
dependencies = [

package-structure-code/pyproject-toml-python-package-metadata.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ what dependencies your package requires.
173173
- Development Status
174174
- Intended Audience
175175
- Topic
176-
- License
177176
- Programming language
178177

179178
### Advanced options in the pyproject.toml file

package-structure-code/python-package-distribution-files-sdist-wheel.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies = [
5353

5454
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:
5555

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.
5757

5858
```toml
5959
classifiers = [
@@ -63,7 +63,6 @@ classifiers = [
6363
# Indicate who your project is intended for
6464
"Intended Audience :: Developers",
6565
"Topic :: Software Development :: Build Tools",
66-
"License :: OSI Approved :: MIT License",
6766
"Programming Language :: Python :: 3 :: Only",
6867
"Programming Language :: Python :: 3.10",
6968
"Programming Language :: Python :: 3.11",

tutorials/add-license-coc.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ In this lesson you will learn:
2626
A license contains legal language about how users can use and reuse your software. To set the `LICENSE` for your project, you:
2727

2828
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.
3030

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.
3232

3333
### What license should you use?
3434

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
3636
license on [choosealicense.com](https://choosealicense.com/).
3737

3838
:::{admonition} Licenses for the scientific Python ecosystem

tutorials/create-python-package.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ readme = {"file" = "README.md", "content-type" = "text/markdown"}
265265
classifiers = [
266266
"Development Status :: 2 - Pre-Alpha",
267267
"Intended Audience :: Science/Research",
268-
"License :: OSI Approved :: MIT License",
269268
"Operating System :: OS Independent",
270269
"Programming Language :: Python :: 3 :: Only",
271270
]

tutorials/pyproject-toml.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,8 @@ you want to have listed as authors and maintainers on your PyPI landing page.
272272
### Step 2: Add README and license
273273

274274
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.
277277

278278
{emphasize-lines="20-21"}
279279
```toml
@@ -297,8 +297,15 @@ maintainers = [
297297
{ name = "New Friend", email = "[email protected]" }
298298
]
299299
readme = "README.md"
300-
license = {file = "LICENSE"}
300+
license = "MIT"
301301
```
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+
302309
### Step 3: Specify Python version with `requires-python`
303310

304311
Add the `requires-python` field to your `pyproject.toml` `[project]` table.
@@ -337,7 +344,7 @@ maintainers = [
337344
{ name = "New Friend", email = "[email protected]" }
338345
]
339346
readme = "README.md"
340-
license = {file = 'LICENSE'}
347+
license = "MIT"
341348
requires-python = ">=3.10"
342349
```
343350

@@ -409,7 +416,7 @@ maintainers = [
409416
{ name = "New Friend", email = "[email protected]" }
410417
]
411418
readme = "README.md"
412-
license = {file = 'LICENSE'}
419+
license = "MIT"
413420
requires-python = ">=3.10"
414421

415422
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
@@ -454,12 +461,11 @@ Review that list and add items below to your `pyproject.toml` file:
454461
- development status
455462
- intended audiences
456463
- topic
457-
- license and
458464
- programming language support
459465

460466
The classifier key should look something like the example below. A few notes:
461467

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
463469
- You can add as many classifiers as you wish as long as you use the [designated PyPI classifier values](https://PyPI.org/classifiers/).
464470

465471
{emphasize-lines="26-34"}
@@ -484,7 +490,7 @@ maintainers = [
484490
{ name = "New Friend", email = "[email protected]" }
485491
]
486492
readme = "README.md"
487-
license = {file = 'LICENSE'}
493+
license = "MIT"
488494
requires-python = ">=3.10"
489495

490496
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
@@ -493,7 +499,6 @@ classifiers = [
493499
"Development Status :: 4 - Beta",
494500
"Intended Audience :: Developers",
495501
"Topic :: Software Development :: Build Tools",
496-
"License :: OSI Approved :: MIT License",
497502
"Programming Language :: Python :: 3 :: Only",
498503
"Programming Language :: Python :: 3.10",
499504
"Programming Language :: Python :: 3.11",
@@ -534,7 +539,7 @@ maintainers = [
534539
{ name = "New Friend", email = "[email protected]" }
535540
]
536541
readme = "README.md"
537-
license = {file = 'LICENSE'}
542+
license = "MIT"
538543
requires-python = ">=3.10"
539544

540545
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
@@ -543,7 +548,6 @@ classifiers = [
543548
"Development Status :: 4 - Beta",
544549
"Intended Audience :: Developers",
545550
"Topic :: Software Development :: Build Tools",
546-
"License :: OSI Approved :: MIT License",
547551
"Programming Language :: Python :: 3 :: Only",
548552
"Programming Language :: Python :: 3.10",
549553
"Programming Language :: Python :: 3.11",
@@ -585,7 +589,7 @@ maintainers = [
585589
{ name = "New Friend", email = "[email protected]" }
586590
]
587591
readme = "README.md"
588-
license = {file = 'LICENSE'}
592+
license = "MIT"
589593
requires-python = ">=3.10"
590594

591595
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
@@ -594,7 +598,6 @@ classifiers = [
594598
"Development Status :: 4 - Beta",
595599
"Intended Audience :: Developers",
596600
"Topic :: Software Development :: Build Tools",
597-
"License :: OSI Approved :: MIT License",
598601
"Programming Language :: Python :: 3 :: Only",
599602
"Programming Language :: Python :: 3.10",
600603
"Programming Language :: Python :: 3.11",
@@ -650,9 +653,6 @@ classifiers = [
650653
"Intended Audience :: Developers",
651654
"Topic :: Software Development :: Build Tools",
652655

653-
# Pick your license (using syntax from the classifier page). We suggest MIT, BSD3 or Apache if you are corporate
654-
"License :: OSI Approved :: MIT License",
655-
656656
# Specify the Python versions ensuring that you indicate you support Python 3.
657657
# this is only for PyPI and other metadata associated with your package - for your users to see
658658
"Programming Language :: Python :: 3 :: Only", # BE sure to specify that you use python 3.x
@@ -665,7 +665,11 @@ dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
665665
# This is the metadata that pip reads to understand what versions your package supports
666666
requires-python = ">=3.10"
667667
readme = "README.md"
668-
license = { file = "LICENSE" }
668+
669+
# Pick your license using the license expression syntax specified here:
670+
# https://packaging.python.org/en/latest/specifications/license-expression/
671+
# We suggest MIT, BSD-3-Clause or Apache-2.0
672+
license = "MIT"
669673

670674
# Add urls for your home page, issue tracker and source code
671675
[project.urls] # Optional

0 commit comments

Comments
 (0)