Skip to content

Remove "License :: ..." classifiers from pyproject.toml examples #564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ Classifiers are just a list of plain strings
```toml
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
]
```
Expand Down
2 changes: 1 addition & 1 deletion examples/extension-hatch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ maintainers = [
description = "An example Python package used to support Python packaging tutorials"
keywords = ["pyOpenSci", "python packaging"]
readme = "README"
license = "BSD-3-Clause"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
]
2 changes: 1 addition & 1 deletion examples/pure-hatch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ maintainers = [
description = "An example Python package used to support Python packaging tutorials"
keywords = ["pyOpenSci", "python packaging"]
readme = "README.md"
license = "BSD-3-Clause"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
]
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion examples/pure-setuptools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ maintainers = [
description = "An example Python package used to support Python packaging tutorials"
keywords = ["pyOpenSci", "python packaging"]
readme = "README.md"
license = "BSD-3-Clause"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
]
dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies = [

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:

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

```toml
classifiers = [
Expand All @@ -63,7 +63,6 @@ classifiers = [
# Indicate who your project is intended for
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
6 changes: 3 additions & 3 deletions tutorials/add-license-coc.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ In this lesson you will learn:
A license contains legal language about how users can use and reuse your software. To set the `LICENSE` for your project, you:

1. Create a `LICENSE` file in your project directory that specifies the license that you choose for your package.
2. Reference that file in your `pyproject.toml` data where metadata are set.
2. Reference that license in your `pyproject.toml` data where metadata are set.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a reference. I would say something like "describe your choice of license with a SPDX expression"


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.
By adding the license reference 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under the new metadata, the LICENSE file will not be included unless the pytproject field project.license-files is specified. This field is not currently covered anywhere in the tutorial.


### What license should you use?

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

:::{admonition} Licenses for the scientific Python ecosystem
Expand Down
1 change: 0 additions & 1 deletion tutorials/create-python-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ readme = {"file" = "README.md", "content-type" = "text/markdown"}
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
]
Expand Down
33 changes: 16 additions & 17 deletions tutorials/pyproject-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ you want to have listed as authors and maintainers on your PyPI landing page.
### Step 2: Add README and license

In the previous lessons, you added both a [README.md](add-readme) file and a [LICENSE](add-license-coc) to your package repository.
Once you have those files, you can add them to your pyproject.toml file as
links following the example below.
Once you have those files, you can refer to the README from your pyproject.toml file, and add a short reference to your LICENSE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metadata no longer references the LICENSE, it now provides a SPDX summary expression of the LICENSE.

following the example below.

The reference to your license should use the [license expression syntax](https://packaging.python.org/en/latest/specifications/license-expression/), which can generally be a short name (with no spaces) for the license, such as "MIT", "BSD-3-Clause" or "Apache-2.0".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use stronger language. The reference must use a valid SPDX license expression. This string is checked by both build tools and PyPI API and close (most often) won't cut it.


{emphasize-lines="20-21"}
```toml
Expand All @@ -297,7 +299,7 @@ maintainers = [
{ name = "New Friend", email = "newbie@pyopensci.org" }
]
readme = "README.md"
license = {file = "LICENSE"}
license = "MIT"
```
### Step 3: Specify Python version with `requires-python`

Expand Down Expand Up @@ -337,7 +339,7 @@ maintainers = [
{ name = "New Friend", email = "newbie@pyopensci.org" }
]
readme = "README.md"
license = {file = 'LICENSE'}
license = "MIT"
requires-python = ">=3.10"
```

Expand Down Expand Up @@ -409,7 +411,7 @@ maintainers = [
{ name = "New Friend", email = "newbie@pyopensci.org" }
]
readme = "README.md"
license = {file = 'LICENSE'}
license = "MIT"
requires-python = ">=3.10"

dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Expand Down Expand Up @@ -454,12 +456,11 @@ Review that list and add items below to your `pyproject.toml` file:
- development status
- intended audiences
- topic
- license and
- programming language support

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

- 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
- Your classifier values might be different depending upon your intended audience, development status of your package and the Python versions that you support
- You can add as many classifiers as you wish as long as you use the [designated PyPI classifier values](https://PyPI.org/classifiers/).

{emphasize-lines="26-34"}
Expand All @@ -484,7 +485,7 @@ maintainers = [
{ name = "New Friend", email = "newbie@pyopensci.org" }
]
readme = "README.md"
license = {file = 'LICENSE'}
license = "MIT"
requires-python = ">=3.10"

dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Expand All @@ -493,7 +494,6 @@ classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -534,7 +534,7 @@ maintainers = [
{ name = "New Friend", email = "newbie@pyopensci.org" }
]
readme = "README.md"
license = {file = 'LICENSE'}
license = "MIT"
requires-python = ">=3.10"

dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Expand All @@ -543,7 +543,6 @@ classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -585,7 +584,7 @@ maintainers = [
{ name = "New Friend", email = "newbie@pyopensci.org" }
]
readme = "README.md"
license = {file = 'LICENSE'}
license = "MIT"
requires-python = ">=3.10"

dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Expand All @@ -594,7 +593,6 @@ classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -650,9 +648,6 @@ classifiers = [
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",

# Pick your license (using syntax from the classifier page). We suggest MIT, BSD3 or Apache if you are corporate
"License :: OSI Approved :: MIT License",

# Specify the Python versions ensuring that you indicate you support Python 3.
# this is only for PyPI and other metadata associated with your package - for your users to see
"Programming Language :: Python :: 3 :: Only", # BE sure to specify that you use python 3.x
Expand All @@ -665,7 +660,11 @@ dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
# This is the metadata that pip reads to understand what versions your package supports
requires-python = ">=3.10"
readme = "README.md"
license = { file = "LICENSE" }

# Pick your license using license expression syntax specified here:
# https://packaging.python.org/en/latest/specifications/license-expression/
# We suggest MIT, BSD-3-Clause or Apache-2.0 if you are corporate
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would leave the if you are corporate out. It leaves the question "what do I use if I'm not corporate" unanswered

license = "MIT"

# Add urls for your home page, issue tracker and source code
[project.urls] # Optional
Expand Down
Loading