What Is The Purpose Of Setuptools Requirements Of The Form "package===version"
Solution 1:
Requirement specifier section in pip
docs links to the official docs for requirement specifiers implemented by setuptools
pkg_resources
. It specifies the formal syntax but says nothing on the semantics.
Overview docs explain semantics but say nothing on the ~=
and ===
stuff that were apparently added somewhere between vv.7 (installed with python 2.7.9) and 16.
When docs fail, it's time to consult the sources. Downloading the setuptools hg repo and annotating pkg_resources/__init__.py
ultimately brings us to changeset 3125 with the message "Implement PEP 440 by using the packaging library".
Indeed, PEP 440, Version Specifiers section explains the syntax and semantics:
- ~= : Compatible release clause <...>
- === : Arbitrary equality clause.
By examining other files in the commit and the related packaging
package, I came to these apparent conclusions:
~=
is never produced; when handled, it acts as a filter according to the rules outlined in the PEP.===
, when handled, signals to fall back to the oldersetuptools
version syntax and comparison logic. It is produced whenever the resulting version string doesn't conform to the PEP.
In pkg_resources._vendor.packaging.specifiers._compare_compatible()
pkg_resources.parse_version()
produces a pkg_resources.SetuptoolsLegacyVersion
rather than pkg_resources.SetuptoolsVersion
Post a Comment for "What Is The Purpose Of Setuptools Requirements Of The Form "package===version""