Registry / serialization / pprintpp

pprintpp

JSON →
library0.4.0pypypi✓ verified 28d ago

pprintpp is a Python library that provides a drop-in replacement for the standard library's `pprint` module. Its main goal is to produce more aesthetically pleasing and readable output for complex data structures like dictionaries and lists, especially with improved indentation and line wrapping. The current version is 0.4.0, and it generally follows a stable, infrequent release cadence given its focused utility.

pip install pprintpp
INSTALL
IMPORT
SIG · PPRINTPP
P
pprintpp
serializationpythonv0.4.0
Install
1.5s avg
Import
15ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.016s · 17.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.014s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pprintpp
✓ import pprintpp
The most common way to use pprintpp, then call functions like pprintpp.pprint().
pprint
✓ import pprintpp as pprint
To use pprintpp as a direct drop-in replacement for the standard library's pprint, shadowing it.

This quickstart demonstrates how to use `pprintpp.pprint` to format a complex dictionary. It also includes a comparison with the standard library's `pprint` to highlight the aesthetic differences provided by `pprintpp`.

import pprintpp data = { 'name': 'John Doe', 'age': 30, 'isStudent': False, 'courses': [ {'title': 'History I', 'credits': 3, 'grade': 'A'}, {'title': 'Math II', 'credits': 4, 'grade': 'B+'}, {'title': 'Literature', 'credits': 3, 'grade': 'A-'} ], 'address': { 'street': '123 Main St', 'city': 'Anytown', 'zip': '12345' } } print('--- Using standard pprint ---') import pprint pprint.pprint(data) print('\n--- Using pprintpp ---') pprintpp.pprint(data)
Debug
Known issues
gotchaWhile advertised as a 'drop-in replacement' for `pprint`, `pprintpp` primarily focuses on improving the visual aesthetics of the output. There might be subtle behavioral differences or edge cases where `pprintpp` does not behave *identically* to the standard library's `pprint` module beyond just formatting, though such cases are rare for typical usage.
fix
Always test specific `pprint` behaviors if relying on obscure or highly specific aspects of the standard library implementation when using `pprintpp`.
affects: All versions
gotchaThe `pprintpp` library has not seen active development or new releases in a couple of years (as of 2024). While its core functionality is stable and it serves its purpose well, users seeking support for very new Python features, advanced `pprint` options, or prompt bug fixes might find the project's maintenance to be limited.
fix
Be aware of the project's maintenance status. For critical applications, consider the stability and lack of recent updates. For basic pretty-printing, it remains highly functional.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pprintpp'
The pprintpp library has not been installed in the current Python environment.
fix
pip install pprintpp
NameError: name 'pprintpp' is not defined
The pprintpp module or its 'pprint' function was not imported correctly before being used.
fix
from pprintpp import pprint
AttributeError: 'NoneType' object has no attribute 'write'
When running in environments without a connected console (e.g., `pythonw` on Windows), `sys.stdout` can be `None`, and `pprintpp` (like `pprint`) attempts to call a `write` method on it.
fix
Ensure the script is run in a console environment or explicitly redirect the output stream using `pprint(obj, stream=open('output.txt', 'w'))` to a file or another valid stream.
Upgrade
Version history
0.4.0latest on PyPI · released Jul 1, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
pprintpp — pip install pprintpp · libregistry