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

Support argcomplete as an optional dependency #2423

Merged
merged 2 commits into from
Oct 15, 2023

Conversation

singingwolfboy
Copy link
Contributor

argcomplete adds tab completion for Python CLIs build with the argparse module -- and it works with configargparse as well. This pull request sets up the Locust CLI to use argcomplete if it's installed, but if it's not installed, users can still use the Locust CLI without tab completion. In addition, this PR adds an "extra" requirement named "completion", so if users run pip install locust[completion], then Pip will install Locust and argcomplete.

@cyberw
Copy link
Collaborator

cyberw commented Oct 15, 2023

Nice! Can you add a note about this in the documentation?

@singingwolfboy
Copy link
Contributor Author

Nice! Can you add a note about this in the documentation?

Sure, I just pushed a commit that does so. Unfortunately, this involves modifying the user's shell, and not everyone knows how to do that correctly, so I did a "happy path" description, and linked to the argcomplete documentation in case things don't go well. Does that work for you?

@cyberw
Copy link
Collaborator

cyberw commented Oct 15, 2023

Perfect

@cyberw cyberw merged commit 2700a5d into locustio:master Oct 15, 2023
1 check passed
@cyberw
Copy link
Collaborator

cyberw commented Oct 16, 2023

@singingwolfboy this doesn't really work when there is no locustfile.py in the current directory. Can it be fixed?

Here's the trace output (after running export _ARC_DEBUG=1) when trying to autocomplete locust --hel

~ locust --helCould not find 'locustfile.py'. See --help for available options.

It is also kind of slow...

@cyberw
Copy link
Collaborator

cyberw commented Oct 16, 2023

Hmm... it really slows down "regular" tab completion (for things like filenames).

@cyberw
Copy link
Collaborator

cyberw commented Oct 24, 2023

@singingwolfboy I'm going to have to revert this because of the above issues being so bad. A fix would be welcome though...

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