snick

Handy gadgets for taming indented text
A small collection of practical utilities for working with indented strings and text formatting:
- Dedent triple-quoted strings without giving up indented code
- Build multi-line output line by line with
Conjoiner - Format data structures like
pprint, but withjson.dumps-style indentation and trailing commas - Strip ANSI codes and stray whitespace from terminal output
- Wrap and indent text blocks for logs and reports
Built on the Python standard library. Nothing extra to install.
Quickstart
Requirements
- Python 3.10 or greater
Installation
Install the latest release from PyPI:
Basic usage
Dedent a triple-quoted string without sacrificing indented code:
| dedent() example | |
|---|---|
Oops! Something went wrong.
Here's what happened:
- The flux capacitor overheated
- Time circuits malfunctioned
Please try again later.
Build multi-line output line by line:
Format a data structure with consistent indentation:
| pretty_format() example | |
|---|---|
{
'user': 'bob',
'permissions': [
'read',
'write',
'execute',
],
'metadata': {
'created': '2026-01-22',
'active': True,
},
}
For more examples, see the Features page.
See it in action
The fastest way to get a feel for snick is to run the interactive demo:
No install required. See the Demo page for a full overview of what it covers.
Prefer reading code? The examples/
directory has a standalone script for every feature.
What's with the name?
There aren't many good synonyms for the verb "indent", but there are a few for the act of making a small dent in something. "Snick" means "to cut a small notch or incision in." Close enough.