-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
add support for environment markers in requirements lines for pip-sync #206
Comments
This missing feature makes the entire pip-tools kinda useless for me. |
FWIW, we've worked around this gap by having a separate |
FWIW, I’ve just observed that |
Bonus points for allowing |
I checked today if pip-compile supported environment markers; the desired behaviour for me would be to get pinned versions with the environment markers copied in the output file. That way, I can still have just one requirement file, but cpython vs pypy could install the appropriate database driver (for CI tests). That said, for now I have different files for local dev, testing, CI tools, and deployment, but I haven’t had a need yet for requirements specific to one of the deployment environments (e.g. debug tools on dev vs monitoring tools on staging and prod), so maybe later I’ll go down the road of splitting requirements more and handling the complexity in my pip-sync commands. |
Related need: Support environment markers for indirect dependencies. Example: I have an application that uses In my Proposed syntax -- leading question mark for modifying indirect dependencies:
|
Observation:
This seems like good news because it's already doing part of what we want. I'll see if I can figure out a way to include these markers in the output |
@barrywhart your feature is quite different to the original issue of outputting the markers. I think you should make a new issue for it and avoid spamming everyone here subscribed to the original issue. |
Good point. BTW, I am creating a PR for the original issue (not including my addition). |
The PR is up now. The existing and new tests are passing for me locally, but the Travis build is failing. For some reason, I am unable to view the Travis build log. Would appreciate any help getting unstuck here. |
PR: #459 |
PR is passing Jenkins now. |
#206: Preserve environment markers from requirements.in
closed by #460 |
I may be missing something obvious, but it's still not working for me. I have this following line in compiled requirements.txt:
This line comes from the same line in If I try to run |
You're right: |
This ticket should be updated. It says that "pip-tools" does not support environment markers. Now that pip-compile supports them, the ticket only applies to pip-sync. Halfway there! |
Fixed by #600 |
Is this supposed to work if, instead of |
Are you asking about the In general, I would say |
I meant in general. My use case is that my application currently uses I guess these kind of use-cases will become less frequent, with Docker and docker-compose kind of workflows. |
Yeah, we've gone through something similar. I created |
pip-compile does support transforming setup.py to requirements.txt, and setup.py supports environment markers: install_requires = [
"requests",
"importlib; python_version == '2.6',
] but I do not know if |
@merwok it does not, from my experience. |
If I have a |
This still does not work for pytest
pytest-cov
pytest-mock
idna<2.8 ; python_version < '2.7'
pycparser<2.18 ; python_version < '2.7'
paramiko<2.4 ; python_version < '2.7'
paramiko ; python_version >= '2.7'
setuptools
wheel ; python_version >= '2.7'
psutil pip-sync dev-requirements.txt Identical output whether in a Python
No packages end up installed aside from |
Environment markers let you specify requirements that are conditional on the environment. They're particularly useful for OS-dependent modules. For instance, if I'm working on a django app from a Linux box, I'd like
pyinotify
installed. But my colleague who uses a mac won't be able to install it - the install will fail.Pip handles these in its requirements specifiers as such:
Unfortunately, this doesn't seem to be supported by pip-tools yet. If I put an environment marker into my
requirements.in
, that is stripped from the generatedrequirements.txt
. I'm not sure ifpip-sync
respects an environment marker in an incoming requirement specifier, but it ought to also.The text was updated successfully, but these errors were encountered: