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
Default to add_completion == False in typer.run #400
Comments
Is this issue up for grabs ? |
I don't know...no response from a maintainer |
I think adding documentation would be fine, but changing the default to False when you get completion for free is weird in my opinion. Even if your coworkers thought it was weird, a simple "you get it for free from the CLI framework" should suffice, shouldn't it? |
You don't really get completion for free: it requires installation, which raises questions, or installing the The reason why I think changing the default for |
What I meant by for free: without me interfering on the Python level. I tend to forget that putting stuff into your configuration files like So far my experience when showing this to co-workers was maybe just a different one. They never knew how they could add completions to their scripts, it had never crossed their minds. But as soon as they saw the help message their interest was piqued, they opened up the documentation and were pleasantly surprised. Maybe the field I'm in also "ticks" a bit differently, as we basically live on the command line. |
Hmm, yeah, good point. I guess there's not one right answer here in terms of behavior, so the existing behavior and any possible changes will always be a compromise for somebody. |
Considering how typer is supposed to be a very easy and smooth way to add argument parsing, etc, to scripts, it does seem like a hurdle to have to disable this extra information. Wanting to add completion feels a lot more like a decision you are making, as opposed to have two extra long lines, added to the script help without having thought about it. Adding this extra bit is, in a way a bit intrusive, IMO. |
The only thing that bothers me about completion is how in recent updates the 'default' completion targets started appearing in the left side This leads to rightwards drift, which almost always lead to the option line being 'by itself' which leads to a 'race to the edges leaving a very awkward empty space in the middle unnecessarily. A cosmetic issue, sure, but i think it matters for a library like this. I do not like the options like this. |
Also in these options i'd like to pass them with typer.run I use that strategy instead of 'app' a lot because i want two different scripts in the same file, and it's just neater if you don't have to interact with click. |
Just want to say I'm happy to put up a PR for any decision that comes out of this discussion. |
This has been fixed by #488, released in |
Thank you! |
Thanks for the discussion everyone! ☕ And thanks for coming back to close the issue. 🍰 |
First Check
Commit to Help
Example Code
Description
I thought I'd introduce Typer via some small scripts where argparse is unwieldy. But having the autocompletion options in the command help scared the absolute crap out of a number of people: they assumed I was overengineering, that it would be complicated. Luckily you can suppress those, as I discovered by reading the source.
(Working to bring the folks I scared around, because typer is an essential quality of life improvement for anyone using Python for pretty much anything.)
Wanted Solution
I'd like to see:
I understand (1) is a big change and not do be taken lightly, and as I discovered in my description of (2) it brings up whether you should be able to pass other Typer options via run. But the first thing I did when I fired up typer for the first time is wonder, "can I suppress those completion options," searched the docs, and found nothing, so (2) would have solved my problem.
I looked at main.py and run is simple as could be, so I could certainly make a PR for (1) if it's wanted. The instructions for contributing documentation look straightforward enough so I could take a crack at (2). That's a little more intimidating given the high standard of the documentation, but I could at least do a first draft.
Wanted Code
Alternatives
Minimally documenting the typer.Typer API. There's already an issue about documenting add_completion: #141, why not do all of 'em?
Operating System
macOS
Operating System Details
No response
Typer Version
0.4.1
Python Version
Python 3.10.2
Additional Context
No response
The text was updated successfully, but these errors were encountered: