Skip to content

Conversation

@patrickjburke245
Copy link

Removed pip-index-options directive from pip_list.rst.

Justification:
--index-url and --extra-index-url are 2 flags that are irrelevant to this command. pip list lists packages that are stored locally, so there's no use in analyzing external indices. pip list might not even scan these external indices when passed either of these flags, which would be further reason to remove these 2 flags.

ListCommand(IndexGroupCommand).add_options(self) link is the function that adds the relevant flags for this command like -l and --format.

The options that would be removed with this PR would be: -i, --index-url
--extra-index-url
--exclude
--no-index
-f, --find-links

However, the --exclude flag allows you to exclude text from the output:

(venv2) ubuntu@ip-172-31-33-143:~$ pip list
Package Version
------- -------
pip     24.0
(venv2) ubuntu@ip-172-31-33-143:~$ pip list --exclude pip
(venv2) ubuntu@ip-172-31-33-143:~$ pip list
Package Version
------- -------
pip     24.0

I'm not sure if those other 2 options do anything when used with this command, but from my initial testing, they're not relevant. Can this PR be adjusted to keep the --exclude flag?

Docs page: https://pip.pypa.io/en/stable/cli/pip_list/#cmdoption-extra-index-url

Removed pip-index-options directive from pip_list.rst.

Justification:
--index-url and --extra-index-url are 2 flags that are irrelevant to this command. `pip list` lists packages that are stored locally, so there's no use in analyzing external indices. `pip list` might not even scan these external indices when passed either of these flags, which would be further reason to remove these 2 flags.

`ListCommand(IndexGroupCommand).add_options(self)` [link](https://github.com/pypa/pip/blob/614e5363639b0e8569300d287913278b74e8679c/src/pip/_internal/commands/list.py#L42) is the function that adds the relevant flags for this command like `-l` and `--format`.

The options that would be removed with this PR would be:
-i, --index-url <url>
--extra-index-url <url>
--exclude <package>
--no-index
-f, --find-links <url>

However, the `--exclude` flag allows you to exclude text from the output:
```bash
(venv2) ubuntu@ip-172-31-33-143:~$ pip list
Package Version
------- -------
pip     24.0
(venv2) ubuntu@ip-172-31-33-143:~$ pip list --exclude pip
(venv2) ubuntu@ip-172-31-33-143:~$ pip list
Package Version
------- -------
pip     24.0
```

I'm not sure if those other 2 options do anything when used with this command.

Docs page: https://pip.pypa.io/en/stable/cli/pip_list/#cmdoption-extra-index-url
@ichard26
Copy link
Member

ichard26 commented Dec 7, 2025

Hello!

These options are meant to support pip list --outdated and pip list --uptodate which will filter the list based off whether the package is outdated or not compared to an external index. I concede that doing something like pip list --outdated --no-index hardly makes sense, but technically you could use --find-links to provide an alternative index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants