-
-
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
Pass arbitrary args to 'pip' from pip-compile and pip-sync, with '--pip-args' #1080
Conversation
Process question: Am I supposed to check the clear-oneliner box myself, or leave that to a reviewer's judgment? |
Codecov Report
@@ Coverage Diff @@
## master #1080 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 34 34
Lines 2476 2499 +23
Branches 307 309 +2
=======================================
+ Hits 2462 2485 +23
Misses 8 8
Partials 6 6
Continue to review full report at Codecov.
|
By the way, we could do the same way on |
Both are fine. |
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.
I think it's worth to mention -- --
technique in README
.
2a26cad
to
fc850ec
Compare
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.
Now includes an example in the pip-sync section of the readme.
While I was there I noticed these sentences are included, in different spots:
If you use multiple Python versions, you can also run ``py -X.Y -m piptools sync`` on Windows and ``pythonX.Y -m piptools sync`` on other systems.
If you use multiple Python versions, you can run ``pip-sync`` as ``py -X.Y -m piptools sync ...`` on Windows and ``pythonX.Y -m piptools sync ...`` on other systems.
@AndydeCleyre what do you think? |
Oh, you mean in this same PR? OK, I can get to it within 12 hours |
FYI I've started the pip-compile work locally, but there are still a few wrinkles to iron out before I push. I'll have to resume work a little later. |
I don't know if this is within scope of this PR, but these changes have exposed to me and expanded already existing problems with the header generation omitting $ echo six > --requirements.in
$ pip-compile -- --requirements.in
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --requirements.in
#
six==1.14.0 # via -r --requirements.in
$ pip-compile -- --requirements.in -- --disable-pip-version-check
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile -- --disable-pip-version-check --requirements.in
#
six==1.14.0 # via -r --requirements.in Those commands in the headers are not valid and will fail. The first will read |
Tomorrow I will have a go at improving Note to self: click_ctx.params == {'src_files': ('--requirements.in', '--', '--disable-pip-version-check'),...} |
OK, so
and also does What do you think of the following judgments regarding "forwarded"
|
I've updated Arguments that are forwarded to pip are not transformed or sorted or omitted, but left as-is as much as possible. Please let me know what you think, and if you want these two commits squashed. |
Actually I think it's quite fine. It's different, in that it adds a Before: $ pip-compile -q --output-file=- - < requirements.in | grep output
# pip-compile --output-file=- - After: $ pip-compile -q --output-file=- - < requirements.in | grep output
# pip-compile --output-file=- -- - |
I guess the real question regarding the last comment is if we want to change behavior for $ pip-compile --output-file=- -- - to treat |
Looks like this will need a careful rebase now that c4dcaf7 is pushed. I see that pip-compile's Would it make sense to add a kwarg to Or would it be preferable to simply extend its return value after it's called, outside that function? |
I'm looking at / merging this c4dcaf7 . . . Is it just me, or are I don't think that was ready for master, maybe I should hold off on merging it into this PR for now. |
@AndydeCleyre see #824 (comment) for details. I'll fix this shortly. |
@AndydeCleyre fixed |
Alright, after merging in those changes last night, I did a proper rebase onto master today. Please have a look. I've included all the concerns I raised above, below. Review Pointers
|
Just a thought, what if we add a new option $ pip-compile --pip-args="--no-cache-dir"
$ pip-compile --pip-args="--no-cache-dir --no-deps --force-reinstall" |
ff84d06
to
7653e46
Compare
I don't mind either way. But if you go with the --pip-args option then no escaping should be done. That should be the users responsibility. |
Thanks everyone, I'll start re-implementing this as a single, quoted arg soon. Time is a little limited for now, especially during the week, but optimistically this PR will ready for another review next week. In the meantime, you are welcome to mention here all the crazy examples you might use with this feature (with spaces and single and double quotes and whatever) to help me test properly. |
For posterity, the "double-dash islands" implementation now lives at my bugfix/321-doubledash-islands branch. I've just pushed a re-implementation to this branch, using Please review and test! |
$ echo | pip-compile - -qo- --pip-args="--cache-dir='/tmp/with spaces'"
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=- --pip-args='--cache-dir='"'"'/tmp/with spaces'"'"'' -
#
# I've checked a header, it looks weird. |
Thanks, I'll check it out. It is a valid and working command, despite the ugly quoting. |
This may just be the price of using I think mitigating the redundant quotes would be functionally fragile and hacky. |
9f1dd65
to
f09688b
Compare
Maybe I'll dig into |
EDIT: Alright, I've rammed through the py2 compatibility issues, but there's probably a better way to do that. I don't like this unsquashed commit at all. Of the choices listed below, I like numbers 3 and 4 about the same, followed by 1. @atugushev Please take a look at the (currently unsquashed) new commit, which special-cases It's probably a fragile idea. Proper quoting can be hell, which is why I prefer the first implementation, to avoid dealing with it. But this hack is only used for the comment, so its perfection isn't as critical as it would be if it were affecting actual So I'm thinking either:
|
7f8609a
to
c13d592
Compare
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.
Awesome! I left a few comments below.
Pass arbitrary args to 'pip install' from pip-sync, with '--pip-args "ARG..."' Pass arbitrary args to 'pip' from pip-compile, with '--pip-args "ARG..."' Add tests Add examples to README Account for ' -- ' (filename escapes) in get_compile_command, for more accurate pip-compile output headers User repr rather than shlex_quote in get_compile_command for --pip-args, to avoid noisy quoting
b04fdef
to
8a2efa1
Compare
splat |
Thank you, @AndydeCleyre, for the great work and patience 🎉 🎉 🎉 |
Thanks @AndydeCleyre and @atugushev |
Technically, pass all args after the second standalone '--' arg, whether or not they're consecutive.Fixes #321
Changelog-friendly one-liners:
Any flags or arguments following two standalone double-dashes (' -- -- ') at the end of pip-compile or pip-sync's argument list are passed on to pipContributor checklist