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

Reject supplied python_version attribute if it does not follow X or X.Y pattern #314

Open
tvalentyn opened this issue Jun 10, 2020 · 0 comments

Comments

@tvalentyn
Copy link

Context: pypa/pip#8419.

When major.minor.patch versions are passed to python_version requirements specification (see https://www.python.org/dev/peps/pep-0508/), pip behavior is not intuitive:

docker -- run -it  --entrypoint /bin/bash python:3.5-slim-stretch
root@bcd3693fbfa1:/# python --version
Python 3.5.9

# installation does not happen even though  3.5.9 > 3.5.3
root@2108678766fc:/# pip install 'typing; python_version > "3.5.3"'                       
Ignoring typing: markers 'python_version > "3.5.3"' don't match your environment 

# installation happens even though  3.5.9 > 3.5.3
root@bcd3693fbfa1:/#  pip install 'typing; python_version < "3.5.3"'                        
Collecting typing
  Downloading typing-3.7.4.1-py3-none-any.whl (25 kB)
Installing collected packages: typing
Successfully installed typing-3.7.4.1

Correct usage seems for this scenario would be for user to pass python_full_version instead of python_version.

However, from a usability point of view, it would be better if pip alerted the user about incorrect usage of python_version rather than proceeding with behavior that does the opposite than a user's intent.

The investigation in pypa/pip#8419 suggested that packaging would be a better place to implement the validation logic for python_version.

@tvalentyn tvalentyn changed the title Reject supplied python_version attribute if it does not follow X.Y pattern Reject supplied python_version attribute if it does not follow X or X.Y pattern Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants