prettyprinter
Syntax-highlighting, declarative and composable pretty printer for Python 3.5+
What it is and what it does
Prettyprinter is a drop-in replacement for Python's standard library pprint that formats data structures with syntax highlighting and readable indentation. It uses a modified Wadler-Leijen layout algorithm to optimize formatting of nested dictionaries, lists, and other common types. The package also provides a declarative interface for registering custom pretty printers for your own classes, so you can define how instances should be displayed without manual string formatting.
The package comes with built-in formatters for datetime, enum, and pytz objects (enabled by default), and optional extras for dataclasses, attrs, django models, numpy arrays, and requests objects. You can install these extras to automatically pretty-print instances of those types. It works by registering type handlers that the printer consults when rendering output, making it easy to extend for domain-specific types.
Use it for:
- Replace pprint in REPL sessions and debugging to get syntax-highlighted, readable output for complex nested data structures.
- Register custom pretty printers for your dataclasses or attrs classes to see them formatted nicely in logs and debugging output.
- Pretty-print Django model instances and querysets in development and testing without writing custom __repr__ methods.
- Format numpy arrays and requests library objects with explicit type information for clearer inspection during development.
- Integrate into Jupyter notebooks or IPython shells to improve the readability of cell output for nested or custom objects.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Syntax-highlighted, declarative pretty printer for Python that formats complex data structures and custom objects with readable output, replacing the standard library pprint with a Wadler-Leijen layout algorithm.
Yes, if you are working with Python 3.5 or 3.6 and want better REPL output formatting without dependencies. No, if you need active maintenance or compatibility with modern Python versions—the package is dormant (last release June 2019, no commits since December 2023) and its classifiers suggest it was never updated beyond Python 3.6. Consider it only for legacy projects or as a reference implementation; for new projects, verify that optional extras work with current library versions.
Install
prettyprinter on PyPI
pip
pip install prettyprinteruv
uv add prettyprinterpoetry
poetry add prettyprinterInstalling prettyprinter
Before you install
Installation is straightforward with no runtime dependencies. However, the package is dormant—last release was 2019-06-22 and no commits since 2023-12-18—so expect no active maintenance or updates for new Python versions or libraries.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install prettyprinter
from prettyprinter import pprint
from datetime import datetime
pprint({'output': datetime.now()})
Verify before relying
- Whether the package remains compatible with Python versions beyond 3.6 despite the classifiers listing only 3.5 and 3.6 support.
- Current state of the optional extras (dataclasses, attrs, django, numpy, requests, pytz) and whether they work with modern versions of those libraries.
- Whether the package is actively maintained or if dormancy signals abandonment.
Package facts
| License | MIT license (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 2,610 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 830,388/month — #4,949 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: prettyprinter-0.18.0-py2.py3-none-any.whl
Keywords: prettyprinter
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
gdbmongoGdbmongo provides GDB pretty printers and…
permissive · top 5,000 on PyPI
python-printrProvides enhanced print functions that format…
unclear · top 15,000 on PyPI
wadler-lindigFormats Python objects for readable output…
permissive · top 5,000 on PyPI
pprintpppprintpp is a drop-in replacement for Python's…
permissive · top 5,000 on PyPI
treescopeTreescope is an interactive HTML pretty-printer…
permissive · top 5,000 on PyPI
pycupsProvides Python bindings to the CUPS printing…
copyleft · top 15,000 on PyPI
structlog-prettyAdds structlog processors that format log…
permissive · top 15,000 on PyPI
wasabiWasabi provides lightweight console printing…
permissive · top 5,000 on PyPI
django-richIntegrates Rich's terminal formatting and…
permissive · top 15,000 on PyPI
better-exceptionsFormats Python exceptions with syntax…
unclear · top 15,000 on PyPI