Skip to content
CAI
Software that uses CAICheck a score

com-lihaoyi/PPrint

50.1

Adequate · 20 September 2026

1.6k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

PPrint is a Scala library for pretty-printing data structures and types, supporting Scala 2.13, Scala 3, and Scala Native. It provides a refactored engine that renders case classes with field names, handles complex type representations, and offers configurable output for debugging and logging. The system features lazy, streaming capabilities to manage large structures efficiently and includes utilities for colored or black-and-white inline printing.

How it got here

2017 — PPrint rebrand and Mill migration

4 changes.

The project was rebranded from TPrint to PPrint and migrated its build infrastructure from SBT to Mill, while adding Scala Native support. Documentation was updated to reflect the new API, including streaming capabilities and context-aware debugging features.

2019 — pretty-printing engine overhaul

3 changes.

The pprint library underwent a major refactoring of its core rendering engine, introducing a lazy AST and a new Renderer class to improve line wrapping, indentation, and configuration options. This period also added Scala 2.13-specific support for including field names in case class rendering and expanded the test suite to cover these new behaviors.

2020–2023 — TPrint overhaul and Scala 3 support

5 changes.

The TPrint macro implementation was completely rewritten to simplify logic and improve type rendering for complex Scala types. A new Scala 3-specific implementation was introduced using quotes and TypeRepr, accompanied by comprehensive test suites for both versions to verify type printing and horizontal formatting behavior.

Features

Add Scala 3-specific pprint implementation

Introduces a new Scala 3 implementation of the pprint library (located in pprint/src-3) to support Scala 3 syntax and reflection APIs. This includes ProductSupport for formatting case classes (with specific handling for field names and 1-arity cases), TPrintImpl for compile-time type printing using Scala 3 quotes and TypeRepr, and CollectionName to access internal collection class names.

pprint/src-3 · high confidence

Include field names in Product rendering for Scala 2.13

When pretty-printing Scala 2.13 case classes (Products), the output now includes field names alongside their values. Field names that are not valid Scala identifiers are automatically wrapped in backticks to ensure correct syntax. This change introduces Scala 2.13-specific support files to handle product element iteration and collection name resolution, replacing previous reflection-based approaches for determining collection class names.

pprint/src-2.13 · high confidence

Behavioural changes

Major overhaul of pretty-printing engine and API

The pprint library has been significantly refactored to improve rendering quality and API usability. The core printing logic has been rewritten using a lazy AST (Abstract Syntax Tree) and a new \Renderer\ class, enabling better handling of line wrapping, indentation, and truncation for large structures. The \PPrinter\ class now exposes explicit configuration options for width, height, indent, unicode escaping, and field name display, along with dedicated \log\ and \err.log\ methods for debugging that include source file and line metadata. Additionally, new string interpolators \pp\ (colored) and \bw\ (black-and-white) have been added for convenient inline pretty-printing, and the library now robustly handles \null\ returns from \toString\ methods and renders common collection subclasses (like \HashMap\) using their standard factory names (e.g., \Map\).

pprint/src · high confidence

Overhaul of TPrint macro implementation

The internal implementation of the TPrint macro has been completely rewritten to simplify logic and improve type rendering. This change introduces a new \TPrintImpl.scala\ file that handles the recursive traversal of Scala types, including specific support for function types (up to arity 22), tuples, infix operators, and type bounds. The new implementation also adds logic to correctly resolve symbol lookups in enclosing scopes and handle refined types, ensuring more accurate and cleaner string representations of complex types in the pprint output.

pprint/src-2 · high confidence

Project rebranded to PPrint with Mill build system migration

The project has been renamed from TPrint to PPrint, updating the README and repository identity. The build system has migrated from the legacy build.sc format to build.mill, utilizing Mill version 1.0.0-RC1. This change includes the addition of a .gitignore file, an MIT LICENSE, and a mill wrapper script to standardize the build environment.

(repo-wide) · high confidence

Updated PPrint documentation with new API examples and streaming details

The README has been updated to include comprehensive documentation for the PPrint library, specifically highlighting the new \pprint.log\ function for context-aware debugging and the \pprint.tokenize\ method for streaming output. The guide now demonstrates how to configure printing options like width and height, and explains the library's lazy, streaming capabilities for handling large data structures without memory issues.

readme · high confidence

Test coverage

Added Scala 3-specific tests for TPrint and Horizontal formatting; Added commented-out JVM-specific TPrint tests; Added test suite for pprint 2.13-specific rendering behaviors; Added tests for TPrint and horizontal printing behavior.

Dependencies

Added Scala Native support and updated dependencies

The project now supports Scala Native, allowing users to run the library on native platforms. This change includes updating the build configuration to support Scala 2.13.0 final and porting the build to Mill, as indicated by the commit messages. Additionally, the package name has been renamed from \ammonite.pprint\ to \pprint\, and the \fansi\ dependency has been upgraded.

(dependencies) · medium confidence

Update build infrastructure and version to 0.9.6

The project build has been updated to use SBT version 1.9.7, and the Scalatex documentation plugin (version 0.3.11) has been added to the build plugins. The library version constant has been set to 0.9.6.

project · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 50.

Lenses

  • Code Health 84
  • Architecture 100
  • Maturity 32
  • Readiness 56
  • Security 67

Changes since last survey

  • 173 commits — 156 feature/other, 17 fixes

By area

  • (root) — 60 commits
  • pprint/src — 31 commits
  • (repo) — 30 commits
  • pprint/test — 14 commits
  • readme/Readme.scalatex — 9 commits
  • pprint/src-3 — 6 commits
  • pprint/src-0 — 5 commits
  • project/Constants.scala — 5 commits
  • pprint/shared — 4 commits
  • .github/workflows — 3 commits
  • .github/FUNDING.yml — 1 commit
  • pprint/src-2 — 1 commit
  • pprint/src-2.11 — 1 commit
  • pprint/src-2.13 — 1 commit
  • readme/resources — 1 commit
  • tprint/src — 1 commit

Notable commits

  • fix: - Add back readme scalatex - Add publishing plugins - Fix edge case where apply prefix is equal or greater than the width of the window, add test
  • fix: - Enforce in some tests that the Color output's plaintext looks the same as the BlackWhite output - Turn PPrinter into a case class - Add tests to ensure configuration works, fix bug in additionalHandlers not being applied recursively - Tweak tests to make sure that ansi-colored toStrings don't mess up our width/height calculation
  • fix: - Fix a bug that was causing us to lose output in certain cases - Swap from ++ back to concat() because ++ was causing problems with map =( - Break out AdvancedTests from VerticalTests
  • fix: Fix PPrinting of booleans and TPrinting of constant types (#75)
  • fix: Fix constructor for dotty
  • fix: Fix link to documentation (#58)
  • fix: Fix macro on Scala 2.13
  • fix: Fix pprint for Product2 (#36)
  • fix: Fix printing of annotated type
  • fix: Fix the use of PPrinter#interpolate in bw and pp interpolators (#158)
  • fix: Merge pull request #46 from tgodzik/fix-annotated-type
  • fix: cherry-pick-hygiene-fixes
  • fix: fix jdk11 build
  • fix: fix readme link
  • fix: fix rendering of field names with backticks (#124)
  • fix: fix url. s/TPrint/PPrint
  • fix: fix wrapping on named fields and add tests
  • change: - Add infix case-class support and tests
  • change: - Collapse NonEmptyIter into .filter, JoinedIter and concat's iterator into ConcatIterator - Basic unit tests for utils functions
  • change: - Rename indent -> indentCount for less ambiguity - Add ability to treat Truncated as a Result, since they're already very similar in semantics - Tests for Truncated -> Result conversion - Result now tracks number of completed lines as an Int, rather whether or a newline exists as a Boolean
  • …and 153 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

com-lihaoyi/PPrint was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 66733cc563c1a4c8d694b3daba69ab643a50dd79 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.