django-rich
Extensions for using Rich with Django.
What it is and what it does
django-rich bridges Rich, a terminal formatting library, with Django's built-in development tools. It provides three main extensions: an enhanced shell command that enables Rich's pretty-printing and auto-imports key Rich functions (on Django 5.2+), a RichCommand base class for custom management commands that adds a Rich Console to your command's output, and a RichRunner test class that replaces Django's default test runner with colorized output and Rich's traceback rendering.
The package is designed to improve developer experience during local development and testing. It requires minimal setup—just add it to INSTALLED_APPS for shell integration, or point TEST_RUNNER to the RichRunner class. All features respect Django's color control flags (--no-color, --force-color), and the test runner's output width can be tuned via the COLUMNS environment variable for CI systems.
Use it for:
- Run Django shell with automatic Rich pretty-printing and inspect/print/pprint functions available without manual import.
- Write custom management commands with colorized, formatted console output using self.console from RichCommand.
- Run tests with colorized output and Rich's traceback rendering to see source code and local values per frame.
- Debug test failures in CI by setting COLUMNS environment variable to control Rich's terminal width detection.
- Combine RichRunner with other test runner classes for customized test output while keeping Rich's formatting.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Rich's terminal formatting and pretty-printing into Django's shell command, management commands, and test runner for colorized, readable output.
Yes. django-rich is production-stable, actively maintained, has no known vulnerabilities, and adds meaningful developer experience improvements with minimal friction. Install it if you use Django's shell, write management commands, or want better test output readability—the setup is trivial and the benefits are immediate.
Install
django-rich on PyPI
pip
pip install django-richuv
uv add django-richpoetry
poetry add django-richInstalling django-rich
Before you install
Low install friction with only two runtime dependencies (django and rich). Actively maintained with recent releases; last commit on 2026-08-13 and production-stable status. No known vulnerabilities.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.
Quickstart
pip install django-rich
# In settings.py, add to INSTALLED_APPS:
INSTALLED_APPS = [
...,
"django_rich",
]
# Or subclass RichCommand for custom management commands:
from django_rich.management import RichCommand
class Command(RichCommand):
def handle(self, *args, **options):
self.console.print("[bold]Hello[/bold]")
Requires Django 4.2 to 6.0 and Python 3.9 to 3.14; features like automatic Rich imports in shell only activate on Django 5.2+.
Verify before relying
- Whether the shell command integration works with IPython or only the standard Python REPL
- Performance impact of colorization on large test suites or CI environments
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — django, rich |
| Maintenance | actively maintained — 330 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 226,927/month — #9,191 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_rich-2.2.0-py3-none-any.whl
Keywords: Django
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
colour-runnerAdds colored output to Python's unittest test…
permissive · top 15,000 on PyPI
richRich renders styled text, tables, progress…
permissive · top 100 on PyPI
rich-argparseFormats argparse and optparse help output with…
permissive · top 1,000 on PyPI
rich-clickRenders Click command-line interfaces with rich…
permissive · top 1,000 on PyPI
django-clickWraps the click command-line library to let you…
permissive · top 15,000 on PyPI
simple-colorsAdds colored and styled text output to terminal…
unclear · top 15,000 on PyPI
django-typerBuilds type-safe Django management command CLIs…
permissive · top 15,000 on PyPI
prettyprinterSyntax-highlighted, declarative pretty printer…
permissive · top 5,000 on PyPI
pdbrpdbr enhances Python's built-in debugger with…
unclear · top 5,000 on PyPI
ansicolorsEmbeds ANSI color and style codes into Python…
permissive · top 5,000 on PyPI