Skip to content
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

Future Python versions might be problematic with the definition of Environment Marker Variable `python_version` #119

Closed
finefoot opened this issue Jan 28, 2018 · 2 comments

Comments

@finefoot
Copy link

commented Jan 28, 2018

There might be a problem with

"python_version": platform.python_version()[:3],
in the future.

The line is using the definition of the Environment Marker Variable python_version according to PEP 508. But what if the Python version will consist of more than 3 characters?

I originally posted this as a question on Stack Overflow https://stackoverflow.com/questions/48119291/whats-with-the-definition-of-environment-marker-variable-python-version-in-pe Just as Martijn Pieters wrote there, something like ".".join(platform.python_version_tuple()[:2]) would fix the problem.

I guess, the PEP would have to be changed first?

pganssle added a commit to pganssle/packaging that referenced this issue Jul 19, 2019

Update python_version definition
This definition of python_version accommodates Python versions with more
than two digits in the major or minor version. This implements an
accompanying change in PEP 508.

See GH issue pypa#119.

pganssle added a commit to pganssle/packaging that referenced this issue Jul 19, 2019

Update python_version definition
This definition of python_version accommodates Python versions with more
than two digits in the major or minor version. This implements an
accompanying change in PEP 508.

See GH issue pypa#119.

pganssle added a commit to pganssle/packaging that referenced this issue Jul 19, 2019

Update python_version definition
This definition of python_version accommodates Python versions with more
than two digits in the major or minor version. This implements an
accompanying change in PEP 508.

See GH issue pypa#119.
@uranusjr

This comment has been minimized.

Copy link
Member

commented Jul 20, 2019

See also pypa/pip#6730 (python3.10: environment markers assume python3.1)

There are two parts to this problem though. This issue covers the first. I believe this is easily amendable, and plan to submit a PR shortly for it.

The second part is more complicated. Currently marker comparison simply use Python’s string comparison logic, so even if we correctly read python_version, '3.10' is still < '3.9'. PEP 508 does say that markers should use version comparison, but its definition of version is much looser than packaging.version.Version (i.e. PEP 440), thus I’m not entirely sure whether it’d work to simply apply packagin.version.parse_version on markers. Some doubts from the top of my head:

  • Is there guarentee that python_version and python_full_version would be parsable with PEP 440? (Or at least work reasonably as LegacyVersion.)
  • Should we just compare everything as version, or should there be rules to treat certain markers as versions, and others as strings?

uranusjr added a commit to uranusjr/packaging that referenced this issue Jul 20, 2019

@pradyunsg

This comment has been minimized.

Copy link
Member

commented Jul 20, 2019

Let's stick with solving this in #165 for now.

pganssle added a commit to pganssle/packaging that referenced this issue Jul 20, 2019

Update python_version definition
This definition of python_version accommodates Python versions with more
than two digits in the major or minor version. This implements an
accompanying change in PEP 508.

See GH issue pypa#119.

@di di closed this in #165 Jul 27, 2019

ptmcg added a commit to ptmcg/packaging that referenced this issue Aug 6, 2019

Update python_version definition
This definition of python_version accommodates Python versions with more
than two digits in the major or minor version. This implements an
accompanying change in PEP 508.

See GH issue pypa#119.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.