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

Make pip <cmd> --help shorter #5399

Open
pradyunsg opened this issue May 13, 2018 · 12 comments
Open

Make pip <cmd> --help shorter #5399

pradyunsg opened this issue May 13, 2018 · 12 comments
Labels
state: needs discussion This needs some more discussion type: enhancement Improvements to functionality

Comments

@pradyunsg
Copy link
Member

'list -h' help is too long to fit one screen

pip list --help on pip 10.0.1
$ pip list --help
Usage:
  pip list [options]

Description:
  List installed packages, including editables.

  Packages are listed in a case-insensitive sorted order.

List Options:
  -o, --outdated              List outdated packages
  -u, --uptodate              List uptodate packages
  -e, --editable              List editable projects.
  -l, --local                 If in a virtualenv that has global access, do not list globally-installed packages.
  --user                      Only output packages installed in user-site.
  --pre                       Include pre-release and development versions. By default, pip only finds stable versions.
  --format <list_format>      Select the output format among: columns (default), freeze, json, or legacy.
  --not-required              List packages that are not dependencies of installed packages.
  --exclude-editable          Exclude editable package from output.
  --include-editable          Include editable package from output.

Package Index Options:
  -i, --index-url <url>       Base URL of Python Package Index (default https://pypi.org/simple). This should point to a repository compliant with PEP 503 (the simple repository API) or a local
                              directory laid out in the same format.
  --extra-index-url <url>     Extra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url.
  --no-index                  Ignore package index (only looking at --find-links URLs instead).
  -f, --find-links <url>      If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory
                              listing.
  --process-dependency-links  Enable the processing of dependency links.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
  --no-color                  Suppress colored output

Previously proposed solution: not showing global options in --help for commands. (cf: #4433 and #3319)


I personally don't think this is an issue; but hey, this is up for discussion.

@pradyunsg pradyunsg added type: enhancement Improvements to functionality state: needs discussion This needs some more discussion labels May 13, 2018
@techtonik
Copy link
Contributor

And what is the alternative to hiding global options?

@pfmoore
Copy link
Member

pfmoore commented Sep 24, 2018

Not hiding them? I don't think there's consensus that "being short enough to fit on one screen" is an important criterion for the help. I'd prefer "documents all available options" as the priority personally. Screens are varying sizes, and have scrollbars in typical environments, so while long help texts are maybe less convenient, I don't personally think that they are a major problem.

@techtonik
Copy link
Contributor

@pfmoore what is the keyboard shortcut that you use to scrollback you typical environment? Because I have to use mouse and getting my hands off keyboard is annoying.

@pfmoore
Copy link
Member

pfmoore commented Sep 24, 2018

I use the mouse, and don't find that annoying. I'm not saying it isn't annoying for you, just that it's not been demonstrated that it's annoying for a sufficient number of users to justify the change. That's what I meant by "consensus".

@techtonik
Copy link
Contributor

If you'll run pip without any options, you get global options. Does that help?

@pfmoore
Copy link
Member

pfmoore commented Sep 24, 2018

I don't need any help, I'm fine with the current behaviour. But if the behaviour was changed, then no, that wouldn't help as I'd have to look in 2 places for the information I want. Nevertheless, it's all subjective, so there's not much point in you trying to persuade me. Rather, what's needed is evidence that this would benefit a lot of other people, enough to overcome the normal "status quo wins" position.

@techtonik
Copy link
Contributor

How do you want to collect the evidence? The only way I can think is to enable A/B testing and measure the time that passes between block of help commands and the next non-help command issued for both variants.

@pradyunsg
Copy link
Member Author

Another thing here is pipenv style -- putting the commands at the end.

Usage: pipenv [OPTIONS] COMMAND [ARGS]...

Options:
  --where             Output project home information.
  --venv              Output virtualenv information.
  --py                Output Python interpreter information.
  --envs              Output Environment Variable options.
  --rm                Remove the virtualenv.
  --bare              Minimal output.
  --completion        Output completion (to be eval'd).
  --man               Display manpage.
  --support           Output diagnostic information for use in GitHub issues.
  --site-packages     Enable site-packages for the virtualenv.  [env var:
                      PIPENV_SITE_PACKAGES]
  --python TEXT       Specify which version of Python virtualenv should use.
  --three / --two     Use Python 3/2 when creating virtualenv.
  --clear             Clears caches (pipenv, pip, and pip-tools).  [env var:
                      PIPENV_CLEAR]
  -v, --verbose       Verbose mode.
  --pypi-mirror TEXT  Specify a PyPI mirror.
  --version           Show the version and exit.
  -h, --help          Show this message and exit.


Usage Examples:
   Create a new project using Python 3.7, specifically:
   $ pipenv --python 3.7

   Remove project virtualenv (inferred from current directory):
   $ pipenv --rm

   Install all dependencies for a project (including dev):
   $ pipenv install --dev

   Create a lockfile containing pre-releases:
   $ pipenv lock --pre

   Show a graph of your installed dependencies:
   $ pipenv graph

   Check your installed dependencies for security vulnerabilities:
   $ pipenv check

   Install a local setup.py into your virtual environment/Pipfile:
   $ pipenv install -e .

   Use a lower-level pip command:
   $ pipenv run pip freeze

Commands:
  check      Checks for security vulnerabilities and against PEP 508 markers
             provided in Pipfile.
  clean      Uninstalls all packages not specified in Pipfile.lock.
  graph      Displays currently-installed dependency graph information.
  install    Installs provided packages and adds them to Pipfile, or (if no
             packages are given), installs all packages from Pipfile.
  lock       Generates Pipfile.lock.
  open       View a given module in your editor.
  run        Spawns a command installed into the virtualenv.
  shell      Spawns a shell within the virtualenv.
  sync       Installs all packages specified in Pipfile.lock.
  uninstall  Un-installs a provided package and removes it from Pipfile.
  update     Runs lock, then sync.

@techtonik
Copy link
Contributor

I like that. But from the recent developments the best is the help for snap.

The snap command lets you install, configure, refresh and remove snaps.
Snaps are packages that work across many different Linux distributions,
enabling secure delivery and operation of the latest apps and utilities.

Usage: snap <command> [<options>...]

         Basics: find, info, install, list, remove
          …more: refresh, revert, switch, disable, enable
        History: changes, tasks, abort, watch
        Daemons: services, start, stop, restart, logs
       Commands: alias, aliases, unalias, prefer
  Configuration: get, set, wait
        Account: login, logout, whoami
    Permissions: interfaces, interface, connect, disconnect
    Development: run, pack, try, ack, known, download

For more information about a command, run 'snap help <command>'.
For a short summary of all commands, run 'snap help --all'.

@techtonik
Copy link
Contributor

But we started to discuss a different topic. The issue is about help for a single command, not for initial list.

@pradyunsg
Copy link
Member Author

In a survey response from a user, where they were asked what would make pip easier for them to use, the user said:

Separate --help into --help and --longhelp; many of the "general options" are pretty specific and end up making it harder to see what commands and options are available for general use.


This response led to @ei8fdb and I spending over an hour working through pip --help and all the other cool pip help prompts, and while we have some ideas, I think we never said that splitting would be worse than status quo. ;)

@ziebam
Copy link
Contributor

ziebam commented Sep 23, 2021

From a user's perspective the current system (--help listing both command-specific and global options) is the most intuitive. I don't think fitting the output on a single screen should be a deal breaker here, since there's lots of variation between screen sizes, resolutions, etc. as mentioned by @pfmoore. Some more explanation regarding the particular methods discussed:

  1. Passing --verbose seems very counter-intuitive to me; I've never thought about doing that when I wanted more information on a specific command in pip or any other tool I've used.
  2. I don't know how up-to-date snap's configuration mentioned in Make pip <cmd> --help shorter #5399 (comment) is and I can't check it as I'm not using Linux, but it seems like the result of running e.g. snap help find would be similar to pip's?
  3. Discerning between --help and --longhelp also seems counter-intuitive for me for the same reason as --verbose. I don't know any other software that uses such distinction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs discussion This needs some more discussion type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

4 participants