python_requires is not compliant with PEP-345, PEP-566 and PEP-508
See original GitHub issueCurrently python_requires
only accepts a version specifier per PEP-440. This is an error.
Pursuant to PEP-345, as sustained in PEP-566, the specification regarding environmental markers is as follows:
The fields that benefit from this marker are:
Requires-Python
Requires-External
Requires-Dist
Provides-Dist
Obsoletes-Dist
Classifier
PEP-566 further sustains this specification:
Usage of environment markers is otherwise unchanged from PEP 345.
Thus, according to PEP-345, PEP-566 and PEP-508 it should be possible to specify an extremely narrow constraint such as:
python_requires = ==3.9.1; implementation_name=='cpython' and implementation_version=='3.9.1b2'
.
As of setuptools 41.4.0 this is an error:
setuptools.extern.packaging.specifiers.InvalidSpecifier: Invalid specifier: '<3.9;implementation_name=='cpython''
Issue Analytics
- State:
- Created 4 years ago
- Comments:33 (18 by maintainers)
Top Results From Across the Web
PEP 508 – Dependency specification for Python Software ...
The language defined is a compact line based format which is already in widespread use in pip requirements files, though we do not...
Read more >CHANGES.rst - platform/external/python/setuptools - Google Git
#1296: Setuptools now vendors its own direct dependencies, no ... #1210: Add support for PEP 345 Project-URL metadata. ... packaging 16.1 and PEP...
Read more >Python packaging unpacked: Metadata | a w macpherson
Relevant PEPs: 301 (classifiers), 425 (compatibility tags), 440 (version numbering), 508 (dependency specification), 566 (metadata 2.1), PEP 621 ...
Read more >vendor - setuptools-39.0.1 - CHANGES.rst - GitLab
#1296: Setuptools now vendors its own direct dependencies, no longer relying on the ... #1210: Add support for PEP 345 Project-URL metadata.
Read more >Dependencies Management in Setuptools
... needs to be specified according to PEP 508 and PEP 440. ... Dependencies that are not available on a package index but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As far as I know, Core Metadata Specification is simply an aggregate view of the different PEP, cf Specification Update Process.
I’m not saying we should do nothing 😃 I’m suggesting that to solve the current issue (i.e. the fact that “
python_requires
is not compliant with PEP-345, PEP-566 and PEP-508”) and given how the different major packaging tools (setuptools
,pip
, PyPI/warehouse
and all the other tools that relied on thepackaging
library) interpreted theRequires-Python
for the last 3 years, we should simply clarify/update the PEPs to match its defacto interpretation.And it doesn’t mean that we should not investigate new ways to specify finer metadata regarding the required python version depending on the interpreter environment but it is likely to need new fields, a new metadata version and some PEP related work.
Fixing this definitely seems worthwhile to me, as it’s not uncommon for projects to be affected by platform-specific standard library limitations that mean they’ll need a newer base Python version in some environments. It also means that a project affected by a regression in a new feature release can clearly indicate that in their metadata:
To be fully effective, it would need to be possible to supply multiple python_requires entries, merging the entries that share the same environment marker text.