question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

python3.10: environment markers assume python 3.1

See original GitHub issue

Environment

  • pip version: (excuse the buggy output here, that’ll get fixed in #6729)
    $ pip --version
    pip 19.1.1 from /home/asottile/workspace/virtualenv/pyvenv10/lib/python3.10/site-packages/pip (python 3.1)
    
  • Python version: (yes, it’s fake – more info here)
    $ python --version --version
    Python 3.10.0a0 (default, Jul 18 2019, 06:01:33) 
    [GCC 7.4.0]
    
  • OS:
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 18.04.2 LTS
    Release:	18.04
    Codename:	bionic
    

Description

environment markers such as python_version < "3.2" are matching while python 3.10 is being used

Expected behavior

I expect them to not match, notably that “3.10” should be considered greater than “3.2”

How to Reproduce

I ran into this while running pip install pre-commit

Output

$ pip install pre-commit
Collecting pre-commit
  Using cached https://files.pythonhosted.org/packages/59/22/13e65062888c1f53619ef557f885817874aabc447e1cbb4cf774ceaf222f/pre_commit-1.17.0-py2.py3-none-any.whl
Collecting aspy.yaml (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/99/ce/78be097b00817ccf02deaf481eb7a603eecee6fa216e82fa7848cd265449/aspy.yaml-1.3.0-py2.py3-none-any.whl
Collecting pyyaml (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/a3/65/837fefac7475963d1eccf4aa684c23b95aa6c1d033a2c5965ccb11e22623/PyYAML-5.1.1.tar.gz
Collecting cfgv>=2.0.0 (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/2f/ec/3c0a56fbc00e6b649c1dc809dc3f12c5796fbfb7940d1167b9bddc67b818/cfgv-2.0.0-py2.py3-none-any.whl
Collecting six (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting toml (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/a2/12/ced7105d2de62fa7c8fb5fce92cc4ce66b57c95fb875e9318dba7f8c5db0/toml-0.10.0-py2.py3-none-any.whl
Collecting importlib-metadata (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/bd/23/dce4879ec58acf3959580bfe769926ed8198727250c5e395e6785c764a02/importlib_metadata-0.18-py2.py3-none-any.whl
Collecting identify>=1.0.0 (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/94/f7/0ad891a459ee50e8774636798ce00e0b445addd8555661da9dbb546676a6/identify-1.4.5-py2.py3-none-any.whl
Collecting futures; python_version < "3.2" (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/cc/26/b61e3a4eb50653e8a7339d84eeaa46d1e93b92951978873c220ae64d0733/futures-3.1.1.tar.gz
Collecting virtualenv>=15.2 (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/eb/9f/33373d471bb9337c8db86b763052964c42f5079ea0de9517bc88acfbad26/virtualenv-16.6.2-py2.py3-none-any.whl
Collecting importlib-resources; python_version < "3.7" (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/2f/f7/b4aa02cdd3ee7ebba375969d77c00826aa15c5db84247d23c89522dccbfa/importlib_resources-1.0.2-py2.py3-none-any.whl
Collecting nodeenv>=0.11.1 (from pre-commit)
  Using cached https://files.pythonhosted.org/packages/00/6e/ed417bd1ed417ab3feada52d0c89ab0ed87d150f91590badf84273e047c9/nodeenv-1.3.3.tar.gz
Collecting zipp>=0.5 (from importlib-metadata->pre-commit)
  Using cached https://files.pythonhosted.org/packages/da/bd/1a5fdf15aa44231fd09f63ecf175b60f057ae37ec65b343bb009364923f3/zipp-0.5.2-py2.py3-none-any.whl
Collecting typing; python_version < "3.5" (from importlib-resources; python_version < "3.7"->pre-commit)
  Using cached https://files.pythonhosted.org/packages/28/b8/a1d6b7cf322f91305bcb5e7d8f6c3028954d1e3e716cddc1cdce2ac63247/typing-3.7.4-py3-none-any.whl
Installing collected packages: pyyaml, aspy.yaml, six, cfgv, toml, zipp, importlib-metadata, identify, futures, virtualenv, typing, importlib-resources, nodeenv, pre-commit
  Running setup.py install for pyyaml ... done
  Running setup.py install for futures ... done
  Running setup.py install for nodeenv ... done
Successfully installed aspy.yaml-1.3.0 cfgv-2.0.0 futures-3.1.1 identify-1.4.5 importlib-metadata-0.18 importlib-resources-1.0.2 nodeenv-1.3.3 pre-commit-1.17.0 pyyaml-5.1.1 six-1.12.0 toml-0.10.0 typing-3.7.4 virtualenv-16.6.2 zipp-0.5.2

The notable interesting lines are any of the ones with python_version as those should have all been skipped

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
pradyunsgcommented, Oct 4, 2019

Indeed! Thanks @Zac-HD!

@xavfernandez FYI - we’d want to update packaging prior to the 19.3 release.

1reaction
Zac-HDcommented, Oct 4, 2019

pypa/packaging#165 has since been merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

12. Virtual Environments and Packages — Python 3.11.1 ...
The solution for this problem is to create a virtual environment, a self-contained directory tree that contains a Python installation for a particular...
Read more >
Changelog — Python 3.11.1 documentation
gh-98790: Assumes that a missing DLLs directory means that standard extension modules are in the executable's directory. gh-98745: Update py.exe launcher to ...
Read more >
The 'extra' environment marker and its operators - Packaging
Comparisons in marker expressions are typed by the comparison operator. The <marker_op> operators that are not in <version_cmp> perform the ...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
For example, assert func(10) == 42 . ... Such a working environment for the testing code is called a test fixture. ... New...
Read more >
What's New In Python 3.6 — Python 3.11.1 documentation
The new PYTHONMALLOC environment variable can now be used to debug the interpreter memory allocation and access errors. Significant improvements in the standard ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found