-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
parse_requirements fails with environment markers #470
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
Comments
Original comment by tysonclugg (Bitbucket: tysonclugg, GitHub: tysonclugg): Are you sure that this isn't because of the following virtualenv bugs, all of which refer to the fact that virtualenv bundles setuptools 0.18.2 and installs that rather than the latest available version (or at least the version you have installed)?
|
Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco): @tysonclugg, I don't think it's a bug with 18.2. I don't think setuptools supports environment markers except in 'extras'. The way to specify a requirement like
So it could be said that the bug lies in pbr, which isn't properly translating a requirements.txt format back into the expected syntax that setuptools requires. In any case, it's not a simple "fix", but rather a feature request, and a non-trivial one, because it would involve supporting a new syntax that's already supported through a different mechanism. |
Can't setuptools support requirement specifiers (environment markers) in pip works, setuptools breaksI have a Unfortunately, using environment markers is supported by Using pip (with Python 3): $ pip install -r requirements.txt
Ignoring dnspython: markers "python_version < '3'" don't match your environment
Installing collected packages: dnspython3
Successfully installed dnspython3-1.12.0 Using setuptools (with Python 3): $ python setup.py develop
error in GuuruBackoffice setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Expected version spec in dnspython3 ;python_version >= '3' at ;python_version >= '3' Related code samples# -- FILE: requirements.txt
dnspython3 ;python_version >= '3'
dnspython ;python_version < '3' # -- FILE: setup.py
from os.path import abspath, dirname, join
from setuptools import setup, find_packages
def read_file(filename):
with open(join(abspath(dirname(__file__)), filename)) as f:
return f.read()
setup(
# ...
install_requires=read_file('requirements.txt'),
# ...
) |
Can't we implement the same (or a matching) requirements parsing as pip for markers and deprecate This way a just single feature/keyword does it all for requirements. And we do away with some confusion, because pip's and setuptools' behavior match more closely. |
Reading the history, in Setuptools 20.5 and more stable in 20.6.8, Setuptools should support environment markers in install_requires and others. I do suspect that this feature can't be widely adopted until older versions of Setuptools have worked their way through retirement. @bittner, can you confirm that the later releases work as you would expect?
Perhaps, but I struggle to think of how this is done without first upgrading the world to Setuptools 20.6.8 or later. |
@jaraco You're right, using the marker's in I'd say you have to add deprecation code to setuptools one days, or you'll never be able to remove a (confusing) feature. |
Wait there is an |
Originally reported by: dims (Bitbucket: dims, GitHub: dims)
Just a simple call like the following fails:
Found this when trying to run tox -e py27 on https://github.com/openstack/oslo.privsep in a mac environment with latest setuptools.
If i edit the line, i can get past the error:
https://github.com/openstack/oslo.privsep/blob/master/requirements.txt#L10
However since OpenStack uses this syntax a lot, it would be great to add support for this syntax:
https://github.com/openstack/requirements/blob/master/global-requirements.txt
Here are some tracebacks to pin point the problem (line numbers may vary!)
The text was updated successfully, but these errors were encountered: