-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Docs] Need migration guide for license expression (PEP 639) about TOML-table-based project.license
deprecation if v77 unavailable
#4903
Comments
Please note that it is not in the scope of this project to support use cases involving discontinued Python versions. Python 3.8 reached EoL in 2024, so use cases involving 3.8, are no longer supported by setuptools dev team. If you wish to use the same codebase to support 3.8 and the following Python versions, I suppose you have a couple of options:
These suggestions are untested. Please make sure to verify and test before adopting. |
Note this issue does not only exist for Python 3.8 but also all existing Python packages using [build-system]
requires = ["setuptools >= 77"]
build-backend = "setuptools.build_meta"
[project]
license = "SPDX expression" However, this ideal setting will not work in the real world. For example, there are many use cases to use Due to this limitation, downstream developers will postpone the PEP 639 migration. The old code will exist until the day the compact layer for table-based |
project.license
deprecation)project.license
deprecation if v77 unavailable
If users want to make sure a version of setuptools that supports a certain feature is being picked up by the build frontend, it does make sense to use a If the environment cannot download the version of the build requirements on the spot, then it needs to be pre-prepared beforehand. These are normal activities when working on builds, not specific to this release. So in a sense, there is no need for a special guide for v77. The same arguments can be used for the whole parsing of If you would to submit a docs PR with improvements that is very welcome, but other than, the release in question is not different than other features previously released. |
#4904 documents the version introducing PEP 639, so the information is available in the docs and warnings. Further PRs for documentation improvements and suggestions are welcome. |
Thanks! A user-friendly warning can prompt the developers to add a command to upgrade python3 -m pip install --upgrade pip setuptools
python3 -m pip git+https://github.com/owner/some-package
python3 -m pip another-package
I wonder if it is suitable to automatically convert setuptools/setuptools/config/_apply_pyprojecttoml.py Lines 201 to 224 in 7c859e0
def _license(dist: Distribution, val: str | dict, root_dir: StrPath | None):
from setuptools.config import expand
if isinstance(val, dict) and set(val) == {'text'} and isinstance(val["text"], str):
# This is for backward compatibility with the old table-based `license` field.
# Convert the old table-based `license` to a string (PEP 639) if it only contains `text`
# and no `file` field.
# E.g. `license = {text = "MIT"}` to `license = "MIT"`
from ._validate_pyproject.formats import SPDX
if SPDX(val['text']):
val = val['text']
if isinstance(val, str):
...
else:
... The deprecation warning will be still emitted on: [project]
license = { text = "non SPDX expression" } or [project]
license = { file = "/path/to/file" } |
Adding this instruction could be confusing for general users. People that need to use
The thing is that not all The reason why we have a warning is that we are prompting the user with a call to action, since it is not trivial and immediate to convert between one and the other. I think the best in the case is to refuse to guess, given that it is a form of legal information. |
Is it in the scope of the project to support use cases involving backwards compatibility across the project itself? Debian's Trixie comes with setuptools 75.8.0-1. This means that there is currently no documented way to package something for both modern Python versions and stable Debian in a uniform way AFAIU. |
The present issue was opened on Mar 20; a few days later we had #4910 "breaking the internet". The present issue is about a different field, but the consequences would seem to be similar. Does this mean the present issue should also be seen in a different light? Related: |
For me, because of the issue here (impossibility to support old Python versions) as well as #4938, PEP639 is going to have the opposite effect than what it intended (improving metadata): I plan to just strip out all license metadata of my packages and just rely on the shipped LICENSE.txt as legal info. |
Summary
TL;DR: TOML-table-based
project.license
is deprecated in the newestsetuptools
. But the highest supportedsetuptools
on Python 3.8 only supports TOML-table-basedproject.license
.setuptools v77.0.0 adds license expression (PEP 639) support in:
cc @abravalheri @cdce8p
For
pyproject.toml
withlicense = { text = "expression" }
:It will emit a warning during installation:
However, setuptools v77.0.0 does not support Python 3.8. The maximum supported version of Python 3.8 is v75.3.2 (v75.4.0 removed Python 3.8 support).
If developers change
project.license = "Apache-2.0"
as the warning suggested (emitted on a Python >=3.9 environment).The build will break on Python 3.8 due to the lack of PEP-639-supported setuptools (maximum is v75.3.2).
OS / Environment
Not related.
Additional Information
pyproject.toml
is a static configuration file. It is impossible for packages that can support multiple Python versions (including EOLs) and also do not emit warnings during building. The warning can suggest developers usesetup.py
but I don't think it is encouraged since they are already usingpyproject.toml
.I'd suggest to do not deprecate TOML-table-based
project.license
with only atext
key. Make the following equivalent:Code of Conduct
The text was updated successfully, but these errors were encountered: