--- id: cheap-repr version: "0.5.2" license: MIT license_treatment: permissive maintenance: dormant --- # cheap-repr — Better version of repr/reprlib for short, cheap string representations. License: permissive · Maintenance: dormant · Downloads: 268.1K/mo ## What it is and what it does cheap_repr is a drop-in replacement for Python's built-in repr() that produces shorter, faster string representations of objects. It truncates long outputs intelligently, handles nesting depth limits, and suppresses expensive repr computations for classes that produce very long strings. The library comes with built-in handlers for common types like lists, dicts, and strings, and lets you register custom repr functions for your own classes. You use it by calling cheap_repr(obj) instead of repr(obj). It respects a configurable suppression threshold (default 300 characters) and max nesting level (default 3), making it useful in debugging, logging, and REPL contexts where repr output can become unwieldy. You can tune behavior globally or per-function, and it catches exceptions in repr functions to prevent crashes. Use it for: - Debug logging of large data structures without truncating manually or waiting for slow repr computations - REPL and interactive environments where long object representations clutter the output - Custom repr registration for domain-specific types to control how they appear in logs and error messages - Preventing performance issues in exception handlers or debuggers that call repr on many objects - Nested data structure inspection where you want to limit depth and width of the output ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides short, fast, configurable string representations as an alternative to the standard library's repr, with built-in handling for common types and an API for registering custom repr functions. Yes, if you work with large or deeply nested data structures and want faster, more readable repr output. The package is stable, has no dependencies, and carries no security vulnerabilities. Maintenance is dormant but the code is mature; install it if your use case matches, but don't expect active feature development. ## Install pip install cheap-repr uv add cheap-repr poetry add cheap-repr ## Installing cheap-repr Before you install: Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2024-08-10 and no commits since then—but the repository remains active and the package is stable enough for production use if your needs haven't changed. License in practice: MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions. Quickstart: from cheap_repr import cheap_repr result = cheap_repr(list(range(100))) print(result) # '[0, 1, 2, ..., 97, 98, 99]' Verify before relying: - Whether pandas DataFrame and Series repr customization (max_rows, max_cols) works with current pandas versions - Performance improvement magnitude compared to reprlib on large nested structures ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: dormant - Downloads: 268.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags repr alternative, string representation truncation, custom repr registration, fast object repr, repr suppression, configurable repr output, reprlib replacement, debugging, repr-customization [View on SkillFed](https://skillfed.io/packages/cheap-repr) · [View on PyPI](https://pypi.org/project/cheap-repr/)