Currently the Django Project supports 1.4, 1.7 and 1.8. In my setup.py
I want to reflect these versions as being supported.
install_requires=[\'Djan
I've read some related code of pkg_resources
. I think the document here is not accurate. Not only pip
fails to find the right package version, python setup.py install
, which actually uses setuptools
, also fails.
Some of the related code:
pip/_vendor/packaging/specifiers.py
# If we have any specifiers, then we want to wrap our iterable in the
# filter method for each one, this will act as a logical AND amongst
# each specifier.
if self._specs:
for spec in self._specs:
iterable = spec.filter(iterable, prereleases=prereleases)
return iterable
You can see that in the comment, the author emphasized that this will cause an AND
amongst each specifier, not OR
. So if you do this:
PickyThing<1.6,>1.9,!=1.9.6,<2.0a0,==2.4c1
You will get nothing!
I tried with this code below:
import pkg_resources
a = ['1.4', '1.8', '1.9.2']
d = pkg_resources.Requirement.parse('PickyThing<1.6,>1.9,!=1.9.6')
r = d.specifier.filter(a)
print(list(r)) # Nothing, just an empty list []
You may want to file a bug to pip so they can fix it.