Skip to content
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

--extra=foo,bar does not work as expected #1430

Closed
ssbarnea opened this issue Jun 22, 2021 · 7 comments · Fixed by #1492 or #1493
Closed

--extra=foo,bar does not work as expected #1430

ssbarnea opened this issue Jun 22, 2021 · 7 comments · Fixed by #1492 or #1493
Labels
bug Something is not working

Comments

@ssbarnea
Copy link
Member

Apparently using --extra with a list of strings does not enable any extras. If the extra string contains commas it needs to be split and and used as a list of extras, which is not happening now. Same option works correctly with pip.

Environment Versions

  1. pip-tools version: 5.2.0
@ssbarnea ssbarnea added the bug Something is not working label Jun 22, 2021
@atugushev
Copy link
Member

Click provides only pip-compile --extra foo --extra bar syntax.

@AndydeCleyre
Copy link
Contributor

What's the main advantage/use-case of --extra EXTRANAME over specifying req[EXTRANAME] in the input? Oh, for when you don't want to use an .in input file at all, just the project's own setup.py.

Yes I think you're right that we need to fix something here. Either:

  • do comma-splitting ourselves
  • improve/correct help output, which is currently misleading

Current help text:

--extra TEXT                    Names of extras_require to install

Actually we've got the same problem there for -P/--upgrade-package, at least.

@AndydeCleyre
Copy link
Contributor

AndydeCleyre commented Sep 21, 2021

Taking a look at all the multiple=True args across the project, just 2 of 8 use plural language:

piptools/scripts/compile.py-    "--extra",
piptools/scripts/compile.py-    "extras",
piptools/scripts/compile.py:    multiple=True,
piptools/scripts/compile.py-    help="Names of extras_require to install",

piptools/scripts/compile.py-    "-f",
piptools/scripts/compile.py-    "--find-links",
piptools/scripts/compile.py:    multiple=True,
piptools/scripts/compile.py-    help="Look for archives in this directory or on this HTML page",

piptools/scripts/compile.py:    "--extra-index-url", multiple=True, help="Add additional index URL to search"

piptools/scripts/compile.py-    "--trusted-host",
piptools/scripts/compile.py:    multiple=True,
piptools/scripts/compile.py-    help="Mark this host as trusted, even though it does not have "
piptools/scripts/compile.py-    "valid or any HTTPS.",

piptools/scripts/compile.py-    "--upgrade-package",
piptools/scripts/compile.py-    "upgrade_packages",
piptools/scripts/compile.py-    nargs=1,
piptools/scripts/compile.py:    multiple=True,
piptools/scripts/compile.py-    help="Specify particular packages to upgrade.",

piptools/scripts/sync.py-    "-f",
piptools/scripts/sync.py-    "--find-links",
piptools/scripts/sync.py:    multiple=True,
piptools/scripts/sync.py-    help="Look for archives in this directory or on this HTML page",

piptools/scripts/sync.py:    "--extra-index-url", multiple=True, help="Add additional index URL to search"

piptools/scripts/sync.py-    "--trusted-host",
piptools/scripts/sync.py:    multiple=True,
piptools/scripts/sync.py-    help="Mark this host as trusted, even though it does not have valid or any HTTPS.",

So I think we should change those two to use singular language, and consider explicitly stating it can be used multiple times (unless click has an option to do that automatically; plumbum displays this info by default, as well as offering a CSV argument type to auto-split).

@AndydeCleyre
Copy link
Contributor

@ssbarnea

Do you think this is fully addressed by #1492? Or do you think the actual parsing of that option ought to be changed, to handle comma-separated lists?

@ssbarnea
Copy link
Member Author

I approved the PR but I see a newly introduced bot/integration that is broken. The PR is useful but ideally we should also allow commas. I was affected by this bug myself, I cannot blame anyone trying to use commas.

AndydeCleyre added a commit to AndydeCleyre/pip-tools that referenced this issue Sep 28, 2021
@AndydeCleyre
Copy link
Contributor

Thanks @ssbarnea!

The broken integration was probably because I worked on an outdated master, but have now rebased.

The comma notation is indeed natural, since that's how these extras are specified in req files. I will submit a separate PR for that, but I don't know if it ought to be an advertised feature.

@AndydeCleyre
Copy link
Contributor

Please see #1493

@AndydeCleyre AndydeCleyre changed the title --extra=foo,bar does not work as intended --extra=foo,bar does not work as expected Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
3 participants