shtab
Automagic shell tab completion for Python CLI applications
Decision gist · record as of 2026-08-14
Yes. shtab is production-stable, actively maintained, has zero security vulnerabilities, and solves a real problem (shell completion) with zero runtime overhead. The copyleft license is not a barrier for using it as a library in your own CLI. Install it if you build Python command-line tools and want to offer your users fast, reliable shell completion.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; shell completion installation is a separate end-user step (not automatic).
- Low friction: pure Python wheel with no runtime dependencies.
- Active maintenance with a release 7 days ago and 461 repository stars.
License · maintenance · safety
MPL-2.0 (copyleft) — MPL-2.0 (copyleft): you must disclose source modifications and distribute under the same license if you modify and redistribute shtab itself, but using it as a library in your own CLI does not impose restrictions on your application's license.
last release 2026-08-07 (7 days) · last repo commit 2026-08-13 · 461 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,607,544 downloads/mo, #2,274 on PyPI
Alternatives
Verify before relying
pip install shtab
import argparse
from shtab import add_argument_to_parser
parser = argparse.ArgumentParser()
add_argument_to_parser(parser)
# End-users then run: your_app --print-completion bash | source- Whether dynamic shell commands (e.g., git branch completion) work reliably across all supported shells
- Performance characteristics when handling very large choice sets or deeply nested subcommands
What it is and what it does
shtab generates static shell completion scripts for Python CLI applications that use argparse. Instead of executing your application every time a user presses tab (which is slow and can have side effects), shtab analyzes your ArgumentParser once and outputs a completion script that your shell can source. It supports bash, zsh, fish, and tcsh, and handles argument choices, file/directory paths, and dynamic shell commands.
You integrate shtab into your CLI in two ways: as a library (add a few lines to your app to expose a --print-completion flag), or as a standalone CLI tool that inspects an external parser object. The package has no runtime dependencies and is actively maintained with support for Python 3.9 through 3.14.
Use it for
- Add bash/zsh completion to an existing argparse CLI with minimal code changes
- Generate completion scripts for distribution with your application package
- Support multiple shells (bash, zsh, fish, tcsh) from a single argparse definition
- Enable dynamic completions (e.g., git branch names) without re-executing the CLI on every tab press
- Provide completion for subcommands and nested argument groups automatically
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
shtab is production-stable, actively maintained, has zero security vulnerabilities, and solves a real problem (shell completion) with zero runtime overhead. The copyleft license is not a barrier for using it as a library in your own CLI. Install it if you build Python command-line tools and want to offer your users fast, reliable shell completion.
Install
shtab on PyPI
Before you install
Low friction: pure Python wheel with no runtime dependencies. Active maintenance with a release 7 days ago and 461 repository stars.
Requires Python 3.9 or later; shell completion installation is a separate end-user step (not automatic).
License in practice
MPL-2.0 (copyleft): you must disclose source modifications and distribute under the same license if you modify and redistribute shtab itself, but using it as a library in your own CLI does not impose restrictions on your application's license.
Quickstart
pip install shtab
import argparse
from shtab import add_argument_to_parser
parser = argparse.ArgumentParser()
add_argument_to_parser(parser)
# End-users then run: your_app --print-completion bash | source
Verify before relying
- Whether dynamic shell commands (e.g., git branch completion) work reliably across all supported shells
- Performance characteristics when handling very large choice sets or deeply nested subcommands
Package facts
| License | MPL-2.0 copyleft |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,607,544 / month, #2,274 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleEnvironment :: MacOS XEnvironment :: Other EnvironmentIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: End Users/DesktopIntended Audience :: Other AudienceIntended Audience :: System AdministratorsOperating System :: MacOSOperating System :: MacOS :: MacOS XOperating System :: POSIXOperating System :: POSIX :: BSDOperating System :: POSIX :: BSD :: FreeBSDOperating System :: POSIX :: LinuxOperating System :: POSIX :: SunOS/SolarisOperating System :: UnixProgramming Language :: Other Scripting EnginesProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Unix ShellTopic :: Desktop EnvironmentTopic :: Education :: Computer Aided Instruction (CAI)Topic :: Education :: TestingTopic :: Office/BusinessTopic :: Other/Nonlisted TopicTopic :: Software DevelopmentTopic :: Software Development :: Build ToolsTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Pre-processorsTopic :: Software Development :: User InterfacesTopic :: SystemTopic :: System :: Installation/SetupTopic :: System :: ShellsTopic :: System :: System ShellsTopic :: TerminalsTopic :: Utilities |
Evidence: shtab-1.10.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “shell tab completion generator”
- shtabGenerates shell tab completion scripts for Python CLI applications…
- auto-click-autoAutomatically enables tab shell completion for Bash, Zsh, and Fish in…
- argcompleteProvides bash and zsh tab completion for Python applications using…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also argcomplete · click-completion · auto-click-auto · colcon-argcomplete · cmd2 · colcon-zsh · jsonargparse · tqdm-loggable · argparse · targ