skillfed

prettyprinter

Syntax-highlighting, declarative and composable pretty printer for Python 3.5+

prettyprinter v0.18.0 830.4K downloads/30d#4,949 on PyPI341
Permissive license MIT license DORMANT released

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 prettyprinter

uv

uv add prettyprinter

poetry

poetry add prettyprinter

Installing 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

Development Status :: 2 - Pre-AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: Python :: 3.5Programming Language :: Python :: 3.6

Tags

pretty print python objectssyntax highlighted output formattingcustom type pretty printingpprint replacementdeclarative pretty printerreadable data structure displaypython output formatting
debuggingrepl-toolsformatting

More Utilities packages