Skip to main content

Fast shell tab completion for conda and all its plugins

Project description

conda-completion

Fast shell tab completion for conda and all its plugins.

A hybrid Python/Rust conda plugin that introspects conda's argparse tree (including all plugin subcommands) and provides instant TAB completions via a tiny Rust binary.

Features

  • Completes all conda commands, flags, and plugin subcommands
  • Package name completion from repodata (conda install nump<TAB>)
  • Version completion (conda install numpy=<TAB> lists available versions)
  • Fuzzy matching for typos (numpie or nupmy suggest numpy)
  • Contextual completions: environment names, task names, channels from project files (conda.toml, pixi.toml, pyproject.toml, environment.yml, anaconda-project.yml, conda-project.yml, lockfiles)
  • Static value completion for conda configuration keys and health checks
  • Descriptions shown alongside candidates (zsh, fish, PowerShell)
  • Fast response time (stat-cached context, no Python on the hot path)
  • Shell support: bash, zsh, PowerShell, and fish (covered by automated tests)
  • Auto-regenerates the completion manifest when plugins are installed or removed

Status

This project is in early development and available from conda-forge.

Quick start (development)

# Clone and set up
git clone https://github.com/conda-incubator/conda-completion
cd conda-completion
pixi install
pixi run build

# Generate the completion manifest
conda completion generate

# Install the shell hook (auto-detects your shell)
conda completion install

# Or target a specific shell
conda completion install bash

# Or use eval directly in your RC file
eval "$(conda completion init bash)"

How it works

conda-completion splits the work into two phases:

Phase 1: Generation (Python, runs once). conda completion generate calls conda's generate_parser(), which loads all registered plugin subcommands. The argparse tree is walked recursively to extract commands, flags, positional arguments, help text, and package names from repodata. The output is a completion.msgpack manifest plus versions.index and versions.store package-version files in the platform cache directory.

Phase 2: Completion (Rust, runs on every TAB). When you press TAB, your shell calls _conda_completer, a small Rust binary (~1 MB). It reads the msgpack manifest for static command/flag/package completions, then walks project files in your working directory for dynamic completions (environment names, task names, channels). No Python runs on the hot path. Package names are matched using a three-tier strategy (prefix, substring, then fuzzy similarity) so typos like numpie still find numpy.

A stat-based file cache tracks (mtime, size) for every source file. If nothing changed since the last TAB press, the binary skips all parsing and serves cached results directly.

What files are read

Project files (walks upward from cwd, first match wins):

File What it provides
conda.toml / pixi.toml / pyproject.toml Environment names, task names, feature names, channels
anaconda-project.yml Environment names, command names
conda-project.yml Environment names, command names
environment.yml Environment name, channels
conda.lock / pixi.lock Locked environment names and channels
conda-lock.yml Channel names

Global state (always read):

File What it provides
~/.conda/environments.txt All registered environment names
~/.condarc Configured channel names
~/.conda/global/global.toml Globally installed tool names

CLI commands

Command Description
conda completion generate Introspect conda's parser, write completion.msgpack
conda completion refresh Force refresh package names and versions from repodata
conda completion install [shell] Generate + install shell RC hook (auto-detects shell)
conda completion uninstall [shell] Remove the RC hook
conda completion init <shell> Print the shell script to stdout
conda completion status Show cache, manifest, package-version, and binary diagnostics

install and uninstall support --dry-run to preview changes and --yes to skip confirmation.

generate and install support --no-repodata to skip package metadata. Use conda completion refresh to force a repodata refresh.

install, init, and uninstall support --command-name for wrapper executables, and CONDA_COMPLETION_COMMAND_NAME provides the same value from the environment.

Development

pixi install
pixi run build       # build Rust binary (release)
pixi run build-debug # build Rust binary (debug)
pixi run test        # run Python + Rust integration tests
pixi run check       # lint + format + typecheck + clippy

License

BSD-3-Clause

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

conda_completion-0.3.0.tar.gz (4.6 MB view details)

Uploaded Source

Built Distribution

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

conda_completion-0.3.0-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file conda_completion-0.3.0.tar.gz.

File metadata

  • Download URL: conda_completion-0.3.0.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for conda_completion-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cc5272c43d61cb520f27a00e8f0f70bd1dddff3b264e041365a68fddd710678d
MD5 34e2b45e2d66bf93b0d2e69c517a799f
BLAKE2b-256 105aa2673617622735c7f5a7434a31929941e89e9f35645afc226963828ae883

See more details on using hashes here.

Provenance

The following attestation bundles were made for conda_completion-0.3.0.tar.gz:

Publisher: release.yml on conda-incubator/conda-completion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file conda_completion-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for conda_completion-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7508230e77529c747ba86ba17925e0d5a8dc5ed1b572afccb6ef696ba80b826
MD5 93f58fbe11ce30002f46bd066730e4a7
BLAKE2b-256 1eef5314e59381aaf0e8b67ddc140169683950a6d5da9ef7e91a9ca19ce57813

See more details on using hashes here.

Provenance

The following attestation bundles were made for conda_completion-0.3.0-py3-none-any.whl:

Publisher: release.yml on conda-incubator/conda-completion

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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