Skip to main content

Logo

shtab

Tests Coverage Quality PyPI conda-forge Downloads LICENCE

  • 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

Features

  • Outputs tab completion scripts for multiple shells

    • bash, zsh, fish, tcsh, powershell

  • Supports

  • <arguments>, --options and sub commands

  • Choices (--say={hello,goodbye})

  • Paths (--file={*.y*ml,*.toml}, --dir=*/)

  • Dynamic shell commands (--branch=$(git branch))


Installation

Choose one of:

  • pip install shtab, or

  • conda install -c conda-forge shtab

See operating system-specific instructions in the docs.

Usage

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,tcsh,fish,powershell}

    • subparser mode: end-users execute your_cli_app completion {bash,zsh,tcsh,fish,powershell}

Examples

See the docs for usage examples.

FAQs

Not working? Check out frequently asked questions.

Alternatives

All these execute the underlying script every time <TAB> is pressed (slow and have side-effects):

Contributions

Please do open issues & pull requests! Some ideas:

  • support python -m prefix (#55)

See CONTRIBUTING.md for more guidance.

git-fame

Hits

Metadata

Release files for shtab 1.14.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shtab 1.14.1
File Size Uploaded Provenance Actions
shtab-1.14.1.tar.gz 71.7 kB With provenance Details for shtab-1.14.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shtab 1.14.1
File Interpreter ABI Platform Actions
shtab-1.14.1-py3-none-any.whl Python 3 none any Details for shtab-1.14.1-py3-none-any.whl

Total release size: 95.1 kB

Release files / shtab-1.14.1.tar.gz

Download URL shtab-1.14.1.tar.gz
Size 71.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b05d36b83f4ac8887efae49c722f4feaa5b5529c700c365646ed78975cedd17b
BLAKE2b-256 checksum
How to use checksums
a7b1ba6b6acb7c792d9eff507525a48b1c50c8d3bac5dd44c6f68ddc6782e05d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.15.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Release files / shtab-1.14.1-py3-none-any.whl

Download URL shtab-1.14.1-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cf3e392728bce92f09ff508ca37d7ef3d0e22dc91301bb5c1bf72339acd4177
BLAKE2b-256 checksum
How to use checksums
6543aee7d5d695f6420b6152f9502f5b31c4d52bd115ae6cb36b93df429f6dbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.15.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

Security for shtab 1.14.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shtab-1.14.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.14.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page