Skip to content
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

Use SPDX license identifier #5643

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Use SPDX license identifier #5643

wants to merge 2 commits into from

Conversation

cdce8p
Copy link

@cdce8p cdce8p commented Nov 17, 2024

PEP 639 recommends the use of SPDX license identifiers.

At the moment the license key is ignored by flit, see pypa/flit#525. However, it's still possible to replace it now. Once the support in flit is added, the value will be used automatically.

At some point, the table will need be be changed to just a string for full PEP 639 compliance. That requires support for it first though. The change is also pretty simple.

-license = {text = "BSD-3-Clause"}
+license = "BSD-3-Clause"

@cdce8p
Copy link
Author

cdce8p commented Nov 18, 2024

Working on adding support in flit now. Marking it as draft until then.

@cdce8p cdce8p marked this pull request as draft November 18, 2024 00:27
@davidism
Copy link
Member

I moved to license = {file = "LICENSE.txt"} because when I re-read the current spec months ago, it seemed like that was "more correct" until SPDX was supported. license = {text = "BSD-3-Clause"} isn't technically valid (it specifies the full text of the license). I'm fairly sure we need to hold off until we can specify both license = "BSD-3-Clause and `license_files = ["LICENSE.txt]" so that both the SPDX and file are present.

@cdce8p
Copy link
Author

cdce8p commented Nov 18, 2024

I moved to license = {file = "LICENSE.txt"} because when I re-read the current spec months ago, it seemed like that was "more correct" until SPDX was supported.

Yeah, that's the current spelling in the docs. I'd just argue that it's probably outdated. There is an open issue to rework that section of the packaging docs. pypa/packaging.python.org#1245
From my experience, it's actually better to use to existing license field to in a way "back-populate" the license expression until that is fully supported

license = {text = "BSD-3-Clause"} isn't technically valid (it specifies the full text of the license).

Just from a metadata perspective, it's fully valid. At least setuptools, poetry, and hatch support it.

I'm fairly sure we need to hold off until we can specify both license = "BSD-3-Clause and `license_files = ["LICENSE.txt]" so that both the SPDX and file are present.

While working on a PR for flit, I noticed that all project.license.file really does atm is include the license file in the sdist. For the wheel a glob ('COPYING*', 'LICENSE*') is used to put in .dist-info. Besides that it should be .dist-info/licenses, the current behavior can also be archived by adding LICENSE.txt to [tool.flit.sdist.include].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants