Skip to main content

Shell autocomplete and intelligent suggestions for Django's manage.py

Project description

django-completion

PyPI version Python versions CI License

Project-aware shell completion for Django's manage.py.

Complete commands, app labels, options, and migration targets from your actual Django project.

$ python manage.py migrate <TAB>
accounts  billing  blog

$ python manage.py migrate accounts <TAB>
0001_initial  0002_add_profile  zero

$ python manage.py runserver --<TAB>
--addrport  --ipv6  --noreload  --nothreading

Installation

Install it in the same environment as your Django project:

pip install django-completion
# or
uv add django-completion

Add the app:

INSTALLED_APPS = [
    ...
    "django_completion",
]

Install the shell hook:

python manage.py autocomplete install

Then restart your terminal or reload your shell config:

source ~/.bashrc   # bash
source ~/.zshrc    # zsh

What Completes

Supported invocation styles:

manage.py <TAB>
./manage.py <TAB>
python manage.py <TAB>
python3 manage.py <TAB>
python ./manage.py <TAB>
uv run python manage.py <TAB>

Completion depth:

  • command names after manage.py
  • app labels and option flags for management commands
  • migrate app labels filtered to apps that have migrations
  • migration names and zero after python manage.py migrate app_label
  • option descriptions in zsh where available

Django can suggest close command names after an error. django-completion prevents many of those errors by completing project-specific commands, app labels, options, and migration targets before you press Enter.

Commands

python manage.py autocomplete status
python manage.py autocomplete status --verbose
python manage.py autocomplete refresh
python manage.py autocomplete uninstall

status --verbose is the best first diagnostic when completion behaves unexpectedly. It reports the cache path, schema version, migration counts, warning count, shell hooks, installed script versions, and package version.

refresh rebuilds .django-completion-cache.json manually. The cache also refreshes automatically after manage.py commands with a 60-second cooldown. To disable auto-refresh:

DJANGO_COMPLETION_AUTO_REFRESH = False

Compatibility

Area Supported
Python 3.10+
Django 4.2+
Shells bash, zsh
OS Linux and macOS expected
Windows not officially supported; WSL with bash/zsh may work
Invocations manage.py, ./manage.py, python manage.py, python3 manage.py, uv run python manage.py
Completion depth commands, app labels, options, migrate app labels, migration names

Safety and Privacy

  • No telemetry.
  • No network calls.
  • Tab completion reads only the local cache file.
  • Tab completion does not import Django.
  • Tab completion does not touch the database.
  • The cache is local runtime state in the project root.
  • The cache contains command names, app labels, option names/help, migration names, warnings, and timestamps.
  • Shell rc edits are marker-delimited and reversible.
  • autocomplete uninstall removes managed shell hooks and managed scripts.
  • The package has no middleware, models, migrations, or request-time behavior.

For teams that prefer strict production settings:

if DEBUG:
    INSTALLED_APPS += ["django_completion"]

DEBUG is not always the right environment switch; separate settings modules or a custom environment flag may fit your deployment process better.

Limitations

  • bash and zsh only; fish is planned for a later release
  • no django-admin support
  • no official native Windows or PowerShell support
  • no global options before command, such as python manage.py --settings config.settings migrate
  • no custom alias support, such as dj migrate
  • no database-aware applied/unapplied migration filtering

Roadmap

Near-term candidates include more wrapper support, better Docker-oriented examples, fish shell support, and additional command-specific completion rules.

Long term, the goal is to learn from real-world usage and explore whether parts of this approach could inform Django's own management-command completion story.

Documentation

Full documentation is at https://soldatov-ss.github.io/django_completion/.

Development

git clone git@github.com:soldatov-ss/django-completion.git
cd django-completion
uv sync
uv run pytest -q
uv run ruff check .
uv run ty check

django-completion was created in 2026 by Soldatov Serhii.

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

django_completion-0.2.4.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

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

django_completion-0.2.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file django_completion-0.2.4.tar.gz.

File metadata

  • Download URL: django_completion-0.2.4.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for django_completion-0.2.4.tar.gz
Algorithm Hash digest
SHA256 bbc296cbeafc3f11e5c3643c0c7a7c0e602623540dbaca445603b6fe088ac2f1
MD5 74dd4ce6301cd9b9629a37a8c086236f
BLAKE2b-256 0c52600237b06eef83bd111a85e57bb05756a82fe40354465094e597d6ecc85c

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_completion-0.2.4.tar.gz:

Publisher: publish.yml on soldatov-ss/django-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 django_completion-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_completion-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0f24d60a0642d65225b14e19bd229f81bf6c40bac411849761f033296a14fb95
MD5 9b4dc1f01514a8e04eadec23f649bb65
BLAKE2b-256 2d023bf06d0b9ed67871e09d3fe66433ae1816e8f6f0e81041c9906e27a5f98a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_completion-0.2.4-py3-none-any.whl:

Publisher: publish.yml on soldatov-ss/django-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