↔️ Automagic shell tab completion for Python CLI applications
Alternatives To Shtab
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
23 days ago1February 27, 2018103wtfplShell
z - jump around
Zsh Autocomplete3,325
12 hours ago6mitShell
🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
Fzf Tab2,055
2 months ago57mitShell
Replace zsh's default completion selection menu with fzf!
Bash Sensible1,907
9 months ago10mitShell
An attempt at saner Bash defaults
Argcomplete1,2051,41241713 days ago101January 03, 202252apache-2.0Python
Python and tab completion, better together.
6 days ago17mitC
Yori is a CMD replacement shell that supports backquotes, job control, and improves tab completion, file matching, aliases, command history, and more.
Gradle Completion935
2 months ago54mitShell
Gradle tab completion for bash and zsh
a year ago26mitShell
Ef-🐟-ient fish keybindings for fzf
Docopt.rs7241,4543532 years ago87March 12, 202149otherRust
Docopt for Rust (command line argument parser).
Cmd25334169425 days ago127April 13, 202215mitPython
cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
Alternatives To Shtab
Select To Compare

Alternative Project Comparisons



Tests Coverage conda-forge PyPI

  • What: Automatically generate shell tab completion scripts for Python CLI apps
  • Why: Speed & correctness. Alternatives like argcomplete and pyzshcomplete are slow and have side-effects
  • How: shtab processes an argparse.ArgumentParser object to generate a tab completion script for your shell


  • Outputs tab completion scripts for
    • bash
    • zsh
    • tcsh
  • Supports
  • Supports arguments, options and subparsers
  • Supports choices (e.g. --say={hello,goodbye})
  • Supports file and directory path completion
  • Supports custom path completion (e.g. --file={*.txt})


Choose one of:

  • pip install shtab, or
  • conda install -c conda-forge shtab

See operating system-specific instructions in the docs.


There are two ways of using shtab:

  • CLI Usage: shtab's own CLI interface for external applications
    • may not require any code modifications whatsoever
    • end-users execute shtab your_cli_app.your_parser_object
  • Library Usage: as a library integrated into your CLI application
    • adds a couple of lines to your application
    • argument mode: end-users execute your_cli_app --print-completion {bash,zsh}
    • subparser mode: end-users execute your_cli_app completion {bash,zsh}


See the docs for usage examples.


Not working? Check out frequently asked questions.


  • argcomplete
    • executes the underlying script every time <TAB> is pressed (slow and has side-effects)
    • only provides bash completion
  • pyzshcomplete
    • executes the underlying script every time <TAB> is pressed (slow and has side-effects)
    • only provides zsh completion
  • click
    • different framework completely replacing the builtin argparse
    • solves multiple problems (rather than POSIX-style "do one thing well")


Please do open issues & pull requests! Some ideas:

  • support fish
  • support powershell

See for more guidance.


Popular Completion Projects
Popular Tabs Projects
Popular Text Processing Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Command Line
Developer Tools
Bash Completion