Skip to main content

pycompgen

Automatically generate shell completions for Python tools installed via uv and pipx.

Currently, bash, zsh, and fish on Linux are supported. Also, only Python tools that use the click or argcomplete libraries are supported, besides some select commands:

  • uv
  • uvx

Installation

uv tool install pycompgen
# Or if you prefer pipx:
pipx install pycompgen

Usage

Run pycompgen to generate completions for all installed tools:

pycompgen

The tool will:

  1. Detect Python packages installed via uv tool and pipx as well as some select commands
  2. Analyze which ones support shell completions
  3. Generate completion files in ~/.cache/pycompgen/
  4. Create a source script to load all completions

Add the source script to your shell config:

# For bash: - add to ~/.bashrc:
source <(pycompgen --source) ; (pycompgen &)

# For zsh: - add to ~/.zshrc:
source <(pycompgen --shell zsh --source) ; (pycompgen --shell zsh &)

This will load the generated shell completions and generate new completions for the next time.

The fish shell will automatically read the completions generated by pycompgen in .cache/fish/generated_completions.

Options

  • --cache-dir PATH: Override the default cache directory
  • --force: Force regeneration of all completions
  • --shell: Target shell - bash, zsh, or fish (default: ${PYCOMPGEN_SHELL:-bash})
  • --verbose: Enable detailed output
  • --source: Only write the source file contents to stdout and exit
  • --cooldown-time: Minimum amount of seconds between regenerations

Development

Install development dependencies:

uv sync --group dev
uv run pre-commit install

Run tests:

uv run pytest

Run linting and formatting:

uv run ruff check src tests
uv run ruff format src tests
uv run mypy src

License

MIT

Metadata

Release files for pycompgen 0.4.0

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

Source distribution (sdist)

Source distribution for pycompgen 0.4.0
File Size Uploaded
pycompgen-0.4.0.tar.gz 31.1 kB Details

Release files / pycompgen-0.4.0.tar.gz

Download URL pycompgen-0.4.0.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
21ca75357e0f3d3be3faa2b1a2cf3810ca08aee5b632fcfd5558ae9028403216
BLAKE2b-256 checksum
How to use checksums
d3932fadacc8f533bb2a7dc3580d2080924dcee17d3f3753110804ec790db8be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.19

Release history Release notifications | RSS feed

This release

0.4.0 This release

1 release file

0.3.0

1 release file

0.2.0

2 release files

0.1.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