--- id: wadler-lindig version: "0.1.7" 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) license_treatment: permissive maintenance: active --- # wadler-lindig — A Wadler–Lindig pretty-printer for Python. License: permissive · Maintenance: active · Downloads: 4.9M/mo ## 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 above — 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 pip install wadler-lindig uv add wadler-lindig poetry add wadler-lindig ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 4.9M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pretty printer for python objects, wadler lindig algorithm, compact pprint alternative, custom repr formatting, nested dataclass pretty printing, ansi color pretty print, space-efficient object formatting, pretty-printing, debugging, formatting [View on SkillFed](https://skillfed.io/packages/wadler-lindig) · [View on PyPI](https://pypi.org/project/wadler-lindig/)