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
[FR] Add support for PEP 643 - metadata for sdists #2685
Labels
Comments
pganssle
added
enhancement
Needs Triage
Issues that need to be evaluated for severity and status.
help wanted
major
Needs Implementation
Issues that are ready to be implemented.
and removed
Needs Triage
Issues that need to be evaluated for severity and status.
labels
May 25, 2021
This will ultimately need pypi/warehouse#9660 to be merged first, otherwise the sdists won't be uploadable to PyPI. |
abravalheri
added a commit
to abravalheri/setuptools
that referenced
this issue
Dec 11, 2021
In pypa#2685 the plan that the community seems to agree on is to always automatically translate `setup.cfg` into a `pyproject.toml` equivalent and then proceed reading/parsing the configuration. The objective of this change is to open space so we can implement this way of reading `setup.cfg` in a new `setuptools.config.setupcfg` module while keeping the legacy way of handling `setup.cfg` around. The rationale behind keeping the legacy way around is that, to avoid breaking existing packages during a transition period, we can compare the old and the new way of parsing the configuration (e.g. via `setuptools.{metadata,options}.compare`) and in the case they are conflicting, use the old way and emit a warning asking the user to report the error.
abravalheri
added a commit
to abravalheri/setuptools
that referenced
this issue
Dec 11, 2021
This is the initial implementation of the "configuration driver" that indirectly reads `setup.cfg` by first converting it to a data structure corresponding to `pyproject.toml` and then expanding it. This idea is based on the approach defined in pypa#2685. LIMITATION: Differently from the `legacy_setupcfg` "configuration driver", `setupcfg` does not support reading other distutils file. The `find_others` flag is removed because of that.
abravalheri
added a commit
to abravalheri/setuptools
that referenced
this issue
Dec 20, 2021
In pypa#2685 the plan that the community seems to agree on is to always automatically translate `setup.cfg` into a `pyproject.toml` equivalent and then proceed reading/parsing the configuration. The objective of this change is to open space so we can implement this way of reading `setup.cfg` in a new `setuptools.config.setupcfg` module while keeping the legacy way of handling `setup.cfg` around. The rationale behind keeping the legacy way around is that, to avoid breaking existing packages during a transition period, we can compare the old and the new way of parsing the configuration (e.g. via `setuptools.{metadata,options}.compare`) and in the case they are conflicting, use the old way and emit a warning asking the user to report the error.
abravalheri
added a commit
to abravalheri/setuptools
that referenced
this issue
Dec 20, 2021
This is the initial implementation of the "configuration driver" that indirectly reads `setup.cfg` by first converting it to a data structure corresponding to `pyproject.toml` and then expanding it. This idea is based on the approach defined in pypa#2685. LIMITATION: Differently from the `legacy_setupcfg` "configuration driver", `setupcfg` does not support reading other distutils file. The `find_others` flag is removed because of that.
FWIW, metadata 2.2 has been supported in warehouse: pypi/warehouse#13606 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
What's the problem this feature will solve?
Some time ago we approved PEP 643, and I intended to implement it... eventually, but it's been a long time and this is actually a very powerful and useful tool for
setuptools
in particular to implement.If done correctly, we should be able to silently and in the background start providing reliable metadata for source distributions to anyone building with new versions of
setuptools
.Describe the solution you'd like
On the install/wheel building side, we need to be aware that if we are consuming an sdist that already has version 2.2+ metadata, we take all non-dynamic values from the sdist, and not from
setup.py
. That way ifsetup.py
and the sdist metadata disagree about a given non-dynamic value, the sdist wins (and we are in compliance with the PEP).For generating PEP 643 metadata (the bigger and more important job, I imagine), there are several implementations (and they can be progressively and backwards-compatibly implemented):
Dynamic
and bump the version to 2.2. (This is not a very useful implenentation, but a valid one).Dynamic
if it comes fromsetup.py
, but not if it comes fromsetup.cfg
orpyproject.toml
(when [FR] support pep-621 - storing core project metadata in pyproject.toml #2671 is resolved).setup.py
— a wrapper likesetuptools.literal_value
, for when someone needs to generate something from code, but it's deterministic for any given release. We don't have to worry too much about this being inaccurate if we also ensure that whensetup.py
and the sdist metadata disagree, the final value from the wheel / installed version is taken from the metadata.setup.py
and determine whensetup()
is passed arguments that we can be sure are deterministic. Literal values, things not assigned inif
blocks, that sort of thing. I suspect that even a small amount of this sort of thing will allow us to unlock a lot of currently deterministic metadata that we'll otherwise have to mark as dynamic, e.g. anything with asetup.py
that looks like this:Alternative Solutions
No response
Additional context
See the discussion on the discourse.
Code of Conduct
The text was updated successfully, but these errors were encountered: