--- id: prettyprinter version: "0.18.0" license: MIT license license_treatment: permissive maintenance: dormant --- # prettyprinter — Syntax-highlighting, declarative and composable pretty printer for Python 3.5+ License: permissive · Maintenance: dormant · Downloads: 830.4K/mo ## 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 above — 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 pip install prettyprinter uv add prettyprinter 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 830.4K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pretty print python objects, syntax highlighted output formatting, custom type pretty printing, pprint replacement, declarative pretty printer, readable data structure display, python output formatting, debugging, repl-tools, formatting [View on SkillFed](https://skillfed.io/packages/prettyprinter) · [View on PyPI](https://pypi.org/project/prettyprinter/)