-
-
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
Filter pip environment markers #647
Filter pip environment markers #647
Conversation
assert out.exit_code == 0 | ||
assert '--output-file requirements.txt' in out.output | ||
assert 'six==1.10.0' in out.output | ||
assert 'unknown_package' not in out.output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this one!
Unfortunately, that implementation breaks the current behavior of keeping the markers in the requirements.txt
which allows to make simple cases compatible cross-environment. See #635 (comment) and the replies afterward.
What could be done would be to make the filtering inside the Resolver
, maybe in check_constraints
or somewhere that applies only to the top-level constraints, so that it only excludes them from the dependency resolving part, which is were the issue currently comes from.
While I was originally discussing the removal of the markers in the requirements.txt
in the comment I linked, I'm now inclined to keep them, because:
- It keeps the simple cases of (ex:
functools32
andenum34
) working cross-environment - It keeps a form of information in the
requirements.txt
that will indicate that there was originally a marker, and that will help with offering support if someone puts a maker on a package with dependencies and can't figure out why some sub-dependencies aren't included in therequirements.txt
.
Thx @vphilippon for you feedback. I tried an implementation which puts the package with the environment marker into the requirements.txt but excludes it from repository lookups and dependency searches. But it will get inconsistent anyway. If I have the requirments.in with: Note that I can find a version on my Repository server for python 2, but for python 3 it is not available and therefore can't be pinned. If you want I can push my changes for further discussion. |
@JoergRittinger Thanks for the detailed example. Your original idea seems to be the best one in the end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good 👍
I believe this got in into 2.0.0? It's missing from the changelog, though? |
You're right, that's what happens with late night releases. Thanks for pointing it out |
Add filter for pip environment markers
Changelog-friendly one-liner: Bugfix: Handling of pip environment markers
Contributor checklist