The Setuptools project itself, as of version 59.1.1, does not use the License
field in its own project source metadata. Further, it no longer explicitly specifies license_file
/license_files
as it did previously, since Setuptools relies on its own automatic inclusion of license-related files matching common patterns, such as the LICENSE
file it uses.
It includes the following license-related metadata in its setup.cfg
:
[metadata] classifiers = License :: OSI Approved :: MIT License
The simplest migration to PEP 639 would consist of using this instead:
[metadata] license_expression = MIT
Or, in the [project]
table of pyproject.toml
:
[project] license = "MIT"
The output Core Metadata for the distribution packages would then be:
License-Expression: MIT License-File: LICENSE
The LICENSE
file would be stored at /setuptools-${VERSION}/LICENSE
in the sdist and /setuptools-${VERSION}.dist-info/licenses/LICENSE
in the wheel, and unpacked from there into the site directory (e.g. site-packages
) on installation; /
is the root of the respective archive and ${VERSION}
the version of the Setuptools release in the Core Metadata.
Suppose Setuptools were to include the licenses of the third-party projects that are vendored in the setuptools/_vendor/
and pkg_resources/_vendor
directories; specifically:
packaging==21.2 pyparsing==2.2.1 ordered-set==3.1.1 more_itertools==8.8.0
The license expressions for these projects are:
packaging: Apache-2.0 OR BSD-2-Clause pyparsing: MIT ordered-set: MIT more_itertools: MIT
A comprehensive license expression covering both Setuptools proper and its vendored dependencies would contain these metadata, combining all the license expressions into one. Such an expression might be:
MIT AND (Apache-2.0 OR BSD-2-Clause)
In addition, per the requirements of the licenses, the relevant license files must be included in the package. Suppose the LICENSE
file contains the text of the MIT license and the copyrights used by Setuptools, pyparsing
, more_itertools
and ordered-set
; and the LICENSE*
files in the setuptools/_vendor/packaging/
directory contain the Apache 2.0 and 2-clause BSD license text, and the Packaging copyright statement and license choice notice.
Specifically, we assume the license files are located at the following paths in the project source tree (relative to the project root and pyproject.toml
):
LICENSE setuptools/_vendor/packaging/LICENSE setuptools/_vendor/packaging/LICENSE.APACHE setuptools/_vendor/packaging/LICENSE.BSD
Putting it all together, our setup.cfg
would be:
[metadata] license_expression = MIT AND (Apache-2.0 OR BSD-2-Clause) license_files = LICENSE setuptools/_vendor/packaging/LICENSE setuptools/_vendor/packaging/LICENSE.APACHE setuptools/_vendor/packaging/LICENSE.BSD
In the [project]
table of pyproject.toml
, license files can be specified via glob patterns:
[project] license = "MIT AND (Apache-2.0 OR BSD-2-Clause)" license-files = [ "LICENSE*", "setuptools/_vendor/LICENSE*", ]
Or alternatively, they can be specified explicitly (paths will be interpreted as glob patterns):
[project] license = "MIT AND (Apache-2.0 OR BSD-2-Clause)" license-files = [ "LICENSE", "setuptools/_vendor/LICENSE", "setuptools/_vendor/LICENSE.APACHE", "setuptools/_vendor/LICENSE.BSD", ]
With either approach, the output Core Metadata in the distribution would be:
License-Expression: MIT AND (Apache-2.0 OR BSD-2-Clause) License-File: LICENSE License-File: setuptools/_vendor/packaging/LICENSE License-File: setuptools/_vendor/packaging/LICENSE.APACHE License-File: setuptools/_vendor/packaging/LICENSE.BSD
In the resulting sdist, with /
as the root of the archive and ${VERSION}
the version of the Setuptools release specified in the Core Metadata, the license files would be located at the paths:
/setuptools-${VERSION}/LICENSE /setuptools-${VERSION}/setuptools/_vendor/packaging/LICENSE /setuptools-${VERSION}/setuptools/_vendor/packaging/LICENSE.APACHE /setuptools-${VERSION}/setuptools/_vendor/packaging/LICENSE.BSD
In the built wheel, with /
being the root of the archive and ${VERSION}
as the previous, the license files would be stored at:
/setuptools-${VERSION}.dist-info/licenses/LICENSE /setuptools-${VERSION}.dist-info/licenses/setuptools/_vendor/packaging/LICENSE /setuptools-${VERSION}.dist-info/licenses/setuptools/_vendor/packaging/LICENSE.APACHE /setuptools-${VERSION}.dist-info/licenses/setuptools/_vendor/packaging/LICENSE.BSD
Finally, in the installed project, with site-packages
being the site dir and ${VERSION}
as the previous, the license files would be installed to:
site-packages/setuptools-${VERSION}.dist-info/licenses/LICENSE site-packages/setuptools-${VERSION}.dist-info/licenses/setuptools/_vendor/packaging/LICENSE site-packages/setuptools-${VERSION}.dist-info/licenses/setuptools/_vendor/packaging/LICENSE.APACHE site-packages/setuptools-${VERSION}.dist-info/licenses/setuptools/_vendor/packaging/LICENSE.BSDExpression examples
Some additional examples of valid License-Expression
values:
License-Expression: MIT License-Expression: BSD-3-Clause License-Expression: MIT AND (Apache-2.0 OR BSD-2-clause) License-Expression: MIT OR GPL-2.0-or-later OR (FSFUL AND BSD-2-Clause) License-Expression: GPL-3.0-only WITH Classpath-Exception-2.0 OR BSD-3-Clause License-Expression: LicenseRef-Public-Domain OR CC0-1.0 OR Unlicense License-Expression: LicenseRef-Proprietary License-Expression: LicenseRef-Custom-License
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4