Skip to main content

Generate shell completions automatically

Project description

pycompgen

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

Currently, only zsh and bash 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:

# Add to ~/.bashrc or ~/.zshrc
source <(pycompgen --source) && (pycompgen &)

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

Options

  • --cache-dir PATH: Override the default cache directory
  • --force: Force regeneration of all completions
  • --shell: Target shell (default: ${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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycompgen-0.1.0.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycompgen-0.1.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file pycompgen-0.1.0.tar.gz.

File metadata

  • Download URL: pycompgen-0.1.0.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pycompgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 10ae144d27824f521ad946682371505a1ab5cae8612563b2e976163ae57e9d85
MD5 f41ce23a62b740c8c90e3fcf9a877c05
BLAKE2b-256 0c5b364ff41563ce9ac63129bdbb08452ce6a4b37888e451a5d21eb188130639

See more details on using hashes here.

File details

Details for the file pycompgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pycompgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pycompgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e50697a764ce4ca1f734f3ec4bf21747506ba445014a8ef035f2675edbee7d5
MD5 16034cf811dbbffeee365def652109b0
BLAKE2b-256 40b2dac9fe96e252a210651919f40ae58f1f5cacc2ded9a7deddbe1ba12b60f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page