-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add pip completion documentation #13542
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
base: main
Are you sure you want to change the base?
Conversation
Hi @notatallshaw, |
Hi @notatallshaw, just checking in, do you have any updates on this? |
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've checked out locally and reproduced the CI errors, I've added comments to help, let me know if you need me to push these commits or if you can handle it.
Thanks a lot for the feedback! |
pre-commit.ci autofix |
Hi @notatallshaw, any updates? |
I've never used this feature and am unfamiliar with how to use it. Just reading the docs you've added: https://pip--13542.org.readthedocs.build/en/13542/cli/pip_completion/ I still don't know how to use this feature. The feature outputs some code to the stdout, and then what? What am I supposed to do with that? Or is the command doing something else? |
eval "$(pip completion --bash)"
# or
eval "$(pip completion --zsh)" That way, the shell sources the completion code on startup. |
I think the point here is that if we're going to document this, we need to include enough information for people who aren't familiar with how completion works to set it up "from scratch". That's going to involve having shell-specific instructions for all the shells we support. |
Yes exactly, I don't find the current "Examples" section particularly helpful, I would rather see "Example Setups" for each shell supported, so for the Bash example I would prefer to see something like: echo 'eval "$(pip completion --bash)"' >> ~/.bashrc If that's a way to add it to Bash. |
Hi @notatallshaw and @pfmoore, |
Hmm, I tried the Powershell instructions, and it doesn't work. I may be doing something wrong, but to be honest that's the whole point, the instructions need to explain to someone like me who doesn't know what to do, how to get a working setup. |
I don't know whether it's relevant, but I seem to have both a |
Yeah, I am also unable to help right now, I tried both the powershell and bash completion instructions and was unable to get either working, I tried debugging for 5 mins with ChatGPT to zero avail. |
Hi @notatallshaw and @pfmoore, thanks a lot for your feedback.
I tried this on a Windows machine and after running
For Bash, the instructions worked for me as expected. I’m sorry I can’t provide a definitive solution; something in your environment may be overriding completion, or you may be encountering the same Windows launcher issue as @pfmoore. |
I don’t think the docs should be trying to help the user to debug issues, we should be giving instructions that don’t need debugging. If the problem is that the completion script is broken, then we need to fix that, but that’s a separate matter. Even if others disagree with the above, the suggestions make no sense to me. I don’t have a conventional |
I’ll admit I’m a bit lost on how to move this forward right now. Thank you for the detailed feedback so far. It’s clear the docs still aren’t in a state where they’re truly “drop-in” usable. From what I can tell, the main culprit is that the pip completion script itself doesn’t work consistently, regardless of how pip is invoked ( Screencast.From.2025-09-23.11-44-41.mp4If we can fix the script to handle these cases, then users shouldn’t need to take extra steps to get |
I agree that step 1 should be to get completion working. Given how many different shells there are, and how many different ways there are to invoke pip, that’s likely to be a significant challenge on its own. But if completion isn’t robust and reliable, documenting how to set it up (and hence increasing the visibility of it) is likely to just result in more support work dealing with issues from users frustrated because it doesn’t work as advertised. |
I agree, but I’m not sure how to move forward. Do you have any ideas? |
I've raised #13593 regarding registering completions for the wrong command. And there is already #13577 covering the fact that Powershell completion is broken on current versions of Powershell. Maybe if someone works on those and produces something that can be tested which actually works immediately when maintainers try to review it, then we can move forward. But to be perfectly honest, I think we'd be better just ripping out completion support. I'm not convinced that it's fixable given the limitations of how shells do completion (which appears to be that you register a completion for a very precise prefix string typed on the command line, rather than being based on what application will ultimately be invoked). I don't think that the minor convenience of tab-completing pip subcommands justifies the complexity and fragility of the feature. I assume that some people like it, though, so leaving it in, warts and all, is probably less disruptive. I'm not motivated to try to "fix" it or document it better, though, as I don't think we can do a good enough job for such changes to be a net benefit. |
Fixes #13536