You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing the install_requires parameter of a setup.py file in a local install pip is incorrectly parsing the requirements and failing to remark on a syntax error.
Expected behavior
When running the command pip install -e . on a local package with the following setup file
import os
import setuptools
THIS_DIR = os.path.dirname(__file__)
# Get the relevant setup parameters from the package
parameters = {}
# Get the long description from the README file
with open(os.path.join(THIS_DIR, 'docs-test', '__about__.py'), 'r') as f:
exec(f.read(), parameters)
setuptools.setup(name='docs-test',
version=parameters['__version__'],
description=parameters['__description__'],
install_requires=['pytest>7<7.2.1'], #Place package dependencies here
packages=setuptools.find_packages(exclude=('*test*',)),
zip_safe=False,
)
The command should fail as the line install_requires=['pytest>7<7.2.1'], #Place package dependencies here is missing comma separators between version constraints
pip version
23.0
Python version
3.10.9
OS
ubuntu
How to Reproduce
In a package's setup.py file specify requirements without comma separators
Run pip install -e .
Note that packages are installed, no error was thrown and versions may be incorrect
Output
Specify requirements without comma separators
(docs-test) user@laptop:~/git_repos/dev/docs_test$ cat setup.py
import os
import setuptools
THIS_DIR = os.path.dirname(__file__)
# Get the relevant setup parameters from the package
parameters = {}
# Get the long description from the README file
with open(os.path.join(THIS_DIR, 'docs-test', '__about__.py'), 'r') as f:
exec(f.read(), parameters)
setuptools.setup(name='docs-test',
version=parameters['__version__'],
description=parameters['__description__'],
install_requires=['pytest>7<7.2.1'], #Place package dependencies here
packages=setuptools.find_packages(exclude=('*test*',)),
zip_safe=False,
)
Run pip install -e .
(docs-test) user@laptop:~/git_repos/dev/docs_test$ pip install -e .
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://builder:****@nexus.ursaspace.com:8443/repository/pypi-releases/simple
Obtaining file:///home/warren/git_repos/dev/docs_test
Preparing metadata (setup.py) ... done
Collecting pytest>7<7.2.1
Using cached https://nexus.ursaspace.com:8443/repository/pypi-releases/packages/cc/02/8f59bf194c9a1ceac6330850715e9ec11e21e2408a30a596c65d54cf4d2a/pytest-7.2.1-py3-none-any.whl (317 kB)
Requirement already satisfied: attrs>=19.2.0 in /home/warren/.local/lib/python3.10/site-packages (from pytest>7<7.2.1->docs-test==1.0.0) (22.1.0)
Requirement already satisfied: pluggy<2.0,>=0.12 in /home/warren/.local/lib/python3.10/site-packages (from pytest>7<7.2.1->docs-test==1.0.0) (1.0.0)
Requirement already satisfied: iniconfig in /home/warren/.local/lib/python3.10/site-packages (from pytest>7<7.2.1->docs-test==1.0.0) (1.1.1)
Requirement already satisfied: tomli>=1.0.0 in /home/warren/.local/lib/python3.10/site-packages (from pytest>7<7.2.1->docs-test==1.0.0) (2.0.1)
Requirement already satisfied: packaging in /home/warren/.local/lib/python3.10/site-packages (from pytest>7<7.2.1->docs-test==1.0.0) (21.3)
Requirement already satisfied: exceptiongroup>=1.0.0rc8 in /home/warren/.local/lib/python3.10/site-packages (from pytest>7<7.2.1->docs-test==1.0.0) (1.0.4)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /home/warren/.local/lib/python3.10/site-packages (from packaging->pytest>7<7.2.1->docs-test==1.0.0) (3.0.9)
Installing collected packages: pytest, docs-test
Running setup.py develop for docs-test
Successfully installed docs-test-1.0.0 pytest-7.2.1
Note package installation and incorrect version
(docs-test) user@laptop:~/git_repos/dev/docs_test$ pip list | grep pytest
pytest 7.2.1
This looks like a bug in setuptools instead? The package should not install, and setuptools should have emitted an error. This example does not contain a pyproject.toml, so pip install -e . is doing a legacy editable installation, and the install_requires is thus parsed by setuptools, not pip. In thet case the main issue is not #11715.
Description
When parsing the install_requires parameter of a setup.py file in a local install pip is incorrectly parsing the requirements and failing to remark on a syntax error.
Expected behavior
When running the command
pip install -e .
on a local package with the following setup fileThe command should fail as the line
install_requires=['pytest>7<7.2.1'], #Place package dependencies here
is missing comma separators between version constraintspip version
23.0
Python version
3.10.9
OS
ubuntu
How to Reproduce
pip install -e .
Output
Specify requirements without comma separators
Run
pip install -e .
Note package installation and incorrect version
Code of Conduct
The text was updated successfully, but these errors were encountered: