Reject supplied python_version attribute if it does not follow X or X.Y pattern
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 751
- Forks
- 324
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 3
Description
Context: https://github.com/pypa/pip/issues/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 https://github.com/pypa/pip/issues/8419 suggested that packaging would be a better place to implement the validation logic for python_version.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review packaging's handling of the python_version marker against the PEP 508 rules and the investigation in pypa/pip#8419. Add validation that rejects values outside the X or X.Y pattern and cover the rejection and valid cases with tests; the issue does not name specific files or existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100