diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92d2a538b..d02a8b4de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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", ] ``` diff --git a/examples/extension-hatch/pyproject.toml b/examples/extension-hatch/pyproject.toml index d8c9092fb..d7a63519c 100644 --- a/examples/extension-hatch/pyproject.toml +++ b/examples/extension-hatch/pyproject.toml @@ -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", ] diff --git a/examples/pure-hatch/pyproject.toml b/examples/pure-hatch/pyproject.toml index f2198b1fc..c6a65d687 100644 --- a/examples/pure-hatch/pyproject.toml +++ b/examples/pure-hatch/pyproject.toml @@ -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 = [ diff --git a/examples/pure-setuptools/pyproject.toml b/examples/pure-setuptools/pyproject.toml index e8d6d27fc..77f19a4cc 100644 --- a/examples/pure-setuptools/pyproject.toml +++ b/examples/pure-setuptools/pyproject.toml @@ -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 = [ diff --git a/package-structure-code/pyproject-toml-python-package-metadata.md b/package-structure-code/pyproject-toml-python-package-metadata.md index 6d155692a..32a5ad393 100644 --- a/package-structure-code/pyproject-toml-python-package-metadata.md +++ b/package-structure-code/pyproject-toml-python-package-metadata.md @@ -173,7 +173,6 @@ what dependencies your package requires. - Development Status - Intended Audience - Topic - - License - Programming language ### Advanced options in the pyproject.toml file diff --git a/package-structure-code/python-package-distribution-files-sdist-wheel.md b/package-structure-code/python-package-distribution-files-sdist-wheel.md index 174378cee..79cf26d2e 100644 --- a/package-structure-code/python-package-distribution-files-sdist-wheel.md +++ b/package-structure-code/python-package-distribution-files-sdist-wheel.md @@ -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 = [ @@ -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", diff --git a/tutorials/add-license-coc.md b/tutorials/add-license-coc.md index 1a210415d..0407e3072 100644 --- a/tutorials/add-license-coc.md +++ b/tutorials/add-license-coc.md @@ -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. Describe your choice of license in your `pyproject.toml` data where metadata are set. -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 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. ### 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 diff --git a/tutorials/create-python-package.md b/tutorials/create-python-package.md index a9b2e3628..4759ec660 100644 --- a/tutorials/create-python-package.md +++ b/tutorials/create-python-package.md @@ -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", ] diff --git a/tutorials/pyproject-toml.md b/tutorials/pyproject-toml.md index 5deaabf74..662b825b5 100644 --- a/tutorials/pyproject-toml.md +++ b/tutorials/pyproject-toml.md @@ -272,8 +272,8 @@ 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 code indicating your choice of LICENSE +following the example below. {emphasize-lines="20-21"} ```toml @@ -297,8 +297,15 @@ maintainers = [ { name = "New Friend", email = "newbie@pyopensci.org" } ] readme = "README.md" -license = {file = "LICENSE"} +license = "MIT" ``` + +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. + +If you have multiple licenses, or a custom license, you can also express these using a license expression. + +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. + ### Step 3: Specify Python version with `requires-python` Add the `requires-python` field to your `pyproject.toml` `[project]` table. @@ -337,7 +344,7 @@ maintainers = [ { name = "New Friend", email = "newbie@pyopensci.org" } ] readme = "README.md" -license = {file = 'LICENSE'} +license = "MIT" requires-python = ">=3.10" ``` @@ -409,7 +416,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"] @@ -454,12 +461,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"} @@ -484,7 +490,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"] @@ -493,7 +499,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", @@ -534,7 +539,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"] @@ -543,7 +548,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", @@ -585,7 +589,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"] @@ -594,7 +598,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", @@ -650,9 +653,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 @@ -665,7 +665,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 the license expression syntax specified here: +# https://packaging.python.org/en/latest/specifications/license-expression/ +# We suggest MIT, BSD-3-Clause or Apache-2.0 +license = "MIT" # Add urls for your home page, issue tracker and source code [project.urls] # Optional