Open harkabeeparolus opened 3 weeks ago
Could they automatically be added to the pyproject.toml
too? (Not sure when but it could be even better)
Could they automatically be added to the
pyproject.toml
too? (Not sure when but it could be even better)
Preferably not, in my opinion... My point is that adding default classifiers automatically to the wheel enables you to specify versions in one place only, instead of copy-pasting or editing them in several different places.
A single source of truth is better than multiple manually managed sources of confusion. š
Specification note: PEP 621 only allows us to do this if with dynamic = ["classifiers"]
. Poetry is allowed to do this since they are not using the [project]
table.
Could they automatically be added to the
pyproject.toml
too? (Not sure when but it could be even better)Preferably not, in my opinion... My point is that adding default classifiers automatically to the wheel enables you to specify versions in one place only, instead of copy-pasting or editing them in several different places.
A single source of truth is better than multiple manually managed sources of confusion. š
Maybe those are two different features then, one could be a command to update "static" classifiers in the pyproject.toml
and another one a setting to enrich classifiers in the build (maybe via the dynamic mode)
Specification note: PEP 621 only allows us to do this if with
dynamic = ["classifiers"]
. Poetry is allowed to do this since they are not using the[project]
table.
That's a good point!
I'm not familiar enough with PEP 621, so I wonder... Would it be possible to use dynamic = ["classifiers"]
to get default values, and at the same time also use manually specified values to override the defaults or to specify additional classifiers?
Specification note: PEP 621 only allows us to do this if with
dynamic = ["classifiers"]
. Poetry is allowed to do this since they are not using the[project]
table.
Update:
I browsed through the specifications for pyproject.toml
as well as Core metadata, which are based partly on PEP 621 and 643, and I see no problems with my suggestion.
While both specifying core metadata AND declaring it to be dynamic is not explicitly mentioned in the specs, it is also clearly not forbidden, as far as I can tell.
In other words, we could certainly have build backends that provide default Python version trove classifiers if unspecified AND if classifiers
is declared as dynamic... And we could include dynamic = ["classifiers"]
in the uv init
templates for the backends that support this feature.
Summary
I wish uv would provide default automatic trove classifiers for Python versions when building wheels.
Poetry adds automatic default Python version (and license) trove classifiers. This improves the package metadata when uploading to PyPI, and means that the developer doesn't have to manage these versions manually as the project's Python requirements change.
Metadata-Version: 2.4
, so we should not implement them, but favourLicense-Expression
instead.Suggested Implementation
Requires-Python
specifier IFpyproject.toml
containsdynamic = ["classifiers"]
.uv init
adddynamic = ["classifiers"]
to thepyproject.toml
template when using a build backend known to support automatic version classifiers.Thanks to @konstin for pointing me towards
dynamic
as a solution.Examples
Example (with Poetry version 1.8.4):
Compare this to uv 0.4.29 (85f9a0d0e 2024-10-30):
(Interestingly, this metadata is actually invalid since it breaks the specification. The
License-Expression
field is not available untilMetadata-Version: 2.4
or later. š³)