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

Release files for shtab 1.12.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.12.1
File Size Uploaded
shtab-1.12.1.tar.gz 66.2 kB Details

Built distribution (wheel)

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

Total release size: 89.0 kB

Release files / shtab-1.12.1.tar.gz

Download URL shtab-1.12.1.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0637338723a8fc08ed1c2fd826d8432229924649c26e3247bb48c53d60ca3bf9
BLAKE2b-256 checksum
How to use checksums
ef71ddb3c0a7a86db44d2fb3f9cbac162f7ddbcbf563b4a174963ba2b3d4d819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.14.7

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 Sep 1, 2026.

Transparency log

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

Download URL shtab-1.12.1-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31d07db9c958fbe15edd1d0f3c966a7085766374a11ccc5861b810fcd4ada123
BLAKE2b-256 checksum
How to use checksums
b33f8bf03f51e920585e207157cb49c5bf8e65a9229297c9ec347a6014eb3d61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.14.7

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 Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.12.1 This release

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.8

2 release files

1.5.7

2 release files

1.5.6

2 release files

1.5.5

2 release files

1.5.4

2 release files

1.5.3

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

1 release file

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

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