-
-
Notifications
You must be signed in to change notification settings - Fork 612
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 additional arguments to pip #321
Comments
I would like to be able to pass |
Just want to check, is there still no way to do this? |
+1 on adding options like --no-cache-dir |
A nice interface for this could be the command-line end marker: |
+1 |
That's a great idea! How to handle UPDATE: Found it https://click.palletsprojects.com/en/7.x/arguments/#option-like-arguments |
@atugushev any updates on this issue ? |
Hello @aorumbayev, Unfortunately, there are no updates. It's still not clear how to pass the additional arguments. |
What if we need to process files containing double-dash? For example: $ touch -- --requirements--.in
$ pip-compile -- --requirements--.in |
@atugushev Not sure I get your question. Recognizing a single token with the exact value of |
I mean how to distinguish filenames and options after $ pip-compile -- --requirements--.in --no-cache-dir |
That wouldn’t be valid.
|
AFAIK, the $ echo six > --requirements.in
$ ls
--requirements.in
$ pip-compile -- --requirements.in
six==1.13.0
$ ls
--requirements.in --requirements.txt |
Yes, this would involve changing the meaning of the token. |
I think it's close to zero. Anyways, I'm in favor to change the meaning of the marker, but, honestly, have no idea how to do it using click API. |
Seems like click automatically accepts I’ve also found this which may be of interest: https://click.palletsprojects.com/en/7.x/advanced/#forwarding-unknown-options |
Another thought on the interpretation of I'm a big fan of plumbum, so checked what happens there, and it's this:
#!/usr/bin/env python3
from plumbum import cli
class Dashes(cli.Application):
nopanic = cli.Flag('no-panic')
def main(self, *args):
if self.nopanic:
print("Don't Panic")
print('args:', args)
if __name__ == '__main__':
Dashes() $ ./dashes.py
args: ()
$ ./dashes.py --no-panic
Don't Panic
args: ()
$ ./dashes.py --no-panic --
Don't Panic
args: ()
$ ./dashes.py -- --no-panic
args: ('--no-panic',)
$ ./dashes.py --uglyfile
Error: Unknown switch --uglyfile
$ ./dashes.py -- --uglyfile
args: ('--uglyfile',)
$ ./dashes.py -- --uglyfile --no-panic
args: ('--uglyfile', '--no-panic')
$ ./dashes.py --no-panic -- --uglyfile -- --elsewhere-bound
Don't Panic
args: ('--uglyfile', '--', '--elsewhere-bound')
$ ./dashes.py -- --for-here
args: ('--for-here',)
$ ./dashes.py -- -- --elsewhere-bound
args: ('--', '--elsewhere-bound') |
So here's a simple way to get this working. Notes:
$ pip-sync <pip-sync arg/flag>... -- -- <pip install arg/flag>...
$ pip-sync <pip-sync arg/flag>... -- --awfully-named-reqs.txt -- <pip install arg/flag>...
install_flags = list(src_files[fwd_args_idx + 1 :]) # black style
install_flags = list(src_files[fwd_args_idx + 1:]) # flake8 style |
@AndydeCleyre I like the idea! Let's go for it ;) |
@atugushev black style vs flake8 style preference? |
I'd prefer black style. See https:/psf/black#slices. |
Hi, just inviting those interested to have a look and comment on #1080 -- please see my latest comment there. |
Please note that I'm holding off on any continued work on #1080 until we can get feedback on @atugushev's suggestion of using $ pip-compile --pip-args="--no-cache-dir --no-deps --force-reinstall" rather than the PR's current state of using $ pip-compile -- -- --no-cache-dir --no-deps --force-reinstall Pinging most recent participants here, @merwok @tim-mitchell @aorumbayev and OP @31z4 Thanks for any feedback! |
I like the |
Quoted args with |
Thanks for the feedback everyone, I'll start re-implementing soon. |
Alright, I've pushed the |
It would be nice to have an ability to pass some non harmful additional arguments to
pip
duringpip-sync
. E. g.--no-cache-dir
or--cache-dir <dir>
.The text was updated successfully, but these errors were encountered: