wadler-lindig
A Wadler–Lindig pretty-printer for Python.
What it is and what it does
Wadler–Lindig is a pretty-printer for Python objects that implements the Wadler–Lindig algorithm, a layout algorithm that breaks lines more intelligently than the built-in pprint module. Instead of pprint's right-aligned continuation style, it produces vertically compact output that respects a target width and indentation level. The library has zero dependencies and is implemented in pure Python.
It is designed for two main use cases: replacing pprint in error messages and debug output where horizontal space matters, and creating custom pretty-printed representations for complex types like nested dataclasses or other tree-like structures. You can customize formatting either by adding a `__pdoc__` method to your class or by passing a `custom` formatter to the pprint call. It also supports ANSI escape codes and provides concise summaries for NumPy arrays and similar types.
Use it for:
- Format error messages and debug output that fit within terminal width constraints without excessive line wrapping.
- Create readable reprs for nested dataclasses or custom types by implementing the `__pdoc__` method.
- Display NumPy arrays in concise form (e.g., `f64[2,3](numpy)`) rather than full element dumps.
- Add ANSI escape codes to pretty-printed output for terminal-based debugging and logging.
- Replace pprint in test assertions or logging where output readability and compactness are both important.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Formats Python objects for readable output using the Wadler–Lindig pretty-printing algorithm, which breaks lines more intelligently than the built-in pprint to consume less horizontal space.
Yes. It is a lightweight, dependency-free tool with active maintenance and no known vulnerabilities. Install it if you need better-formatted object output than pprint in error messages, debug logs, or custom repr implementations. The Alpha status is not a blocker—the algorithm itself is well-established—but be aware the API may change in minor ways before 1.0.
Install
wadler-lindig on PyPI
pip
pip install wadler-lindiguv
uv add wadler-lindigpoetry
poetry add wadler-lindigInstalling wadler-lindig
Before you install
Low friction: pure Python with zero runtime dependencies, distributed as a wheel. Active maintenance with recent commits and no known vulnerabilities.
License in practice
Apache License 2.0 (permissive): you can use, modify, and distribute this code freely in commercial and private projects, provided you include a copy of the license and note any changes you make.
Quickstart
pip install wadler_lindig
import wadler_lindig as wl
obj = {"key": [1, 2, 3], "nested": {"x": "value"}}
wl.pprint(obj, width=30)
Requires Python 3.10 or later.
Verify before relying
- Whether the library handles all standard Python types (e.g., sets, frozensets, custom iterables) beyond the documented examples.
- Performance characteristics when formatting very large or deeply nested structures.
- Stability of the API given the 'Alpha' development status (0.1.7 version).
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 422 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,850,104/month — #2,214 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: wadler_lindig-0.1.7-py3-none-any.whl
Keywords: leijen, lindig, pprint, pretty-printer, wadler
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
pprintpppprintpp is a drop-in replacement for Python's…
permissive · top 5,000 on PyPI
prettyprinterSyntax-highlighted, declarative pretty printer…
permissive · top 5,000 on PyPI
python-printrProvides enhanced print functions that format…
unclear · top 15,000 on PyPI
paragraphsProvides a single function that joins…
permissive · top 15,000 on PyPI
pyinkPyink is a Python code formatter forked from…
permissive · top 15,000 on PyPI
gdbmongoGdbmongo provides GDB pretty printers and…
permissive · top 5,000 on PyPI
django-richIntegrates Rich's terminal formatting and…
permissive · top 15,000 on PyPI
treescopeTreescope is an interactive HTML pretty-printer…
permissive · top 5,000 on PyPI
artConverts text and generates one-line ASCII art…
permissive · top 5,000 on PyPI