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

Support markers in requirements files #1433

Closed
vstinner opened this Issue Jan 7, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@vstinner
Contributor

vstinner commented Jan 7, 2014

Hi,

I'm working on the OpenStack project which uses "requirements.txt" text files to list dependencies. The problem is that there are dependencies which are Python 2 specific, whereas others are only working on Python 3. I need a way to specify that such dependency is only for Python 2 or only for Python 3. Supporting markers in requirements.txt would be a generic solution, example of syntax:

iso8601
mox [sys.version_info < (3,)]
mox3 [sys.version_info >= (3,)]

Python 2 would install iso8601 and mox, Python 3 would install iso8601 and mox3.

@vstinner

This comment has been minimized.

Show comment
Hide comment
@vstinner

vstinner Jan 10, 2014

Contributor

Another usecase. I'm working on a port of the new Tulip project (written for Python 3.3+) on Python 2: Trollius. Trollius uses backports of Python 3 modules for Python 2. Trollius on Python 2.7 requires futures, on Python 2.6 it requires futures and ordereddict.

I don't see how to specify in requirements.txt that I don't want to install ordereddict on Python 2.7 (collections.OrderedDict is already available), but only on Python 2.6.

(Trollius is not related to tox or OpenStack, at least, not yet :-))

Contributor

vstinner commented Jan 10, 2014

Another usecase. I'm working on a port of the new Tulip project (written for Python 3.3+) on Python 2: Trollius. Trollius uses backports of Python 3 modules for Python 2. Trollius on Python 2.7 requires futures, on Python 2.6 it requires futures and ordereddict.

I don't see how to specify in requirements.txt that I don't want to install ordereddict on Python 2.7 (collections.OrderedDict is already available), but only on Python 2.6.

(Trollius is not related to tox or OpenStack, at least, not yet :-))

@piotr-dobrogost

This comment has been minimized.

Show comment
Hide comment
@piotr-dobrogost

piotr-dobrogost commented May 21, 2014

Related issue #1795

dstufft added a commit to dstufft/pip that referenced this issue Nov 20, 2014

Fix issue pypa#1433: parse requirements in markers
* InstallRequirement supports PEP 426 markers
* RequirementSet.add_requirement() ignores an InstallRequirement if
  markers don't match.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment