snick
Handy gadgets for taming indented text
Stop wrestling with indented triple-quoted strings and awkward text formatting. snick makes it effortless to:
- Dedent triple-quoted strings while keeping your code beautifully indented
- Build complex multi-line output programmatically with the powerful
Conjoinerclass - Format data structures with clean indentation and trailing commas
- Clean up terminal output by stripping ANSI codes and whitespace
- Wrap and indent long text blocks for logs and reports
All with zero dependencies.
Quickstart
Requirements
- Python 3.10 or greater
Installation
Install the latest release from PyPI:
Basic Usage
Ever struggle with indented triple-quoted strings in your code?
| dedent() example | |
|---|---|
Output:
Oops! Something went wrong.
Here's what happened:
- The flux capacitor overheated
- Time circuits malfunctioned
Please try again later.
Build complex output on the fly:
Output:
Format data structures with proper indentation:
| pretty_format() example | |
|---|---|
Output:
{
'user': 'bob',
'permissions': [
'read',
'write',
'execute',
],
'metadata': {
'created': '2026-01-22',
'active': True,
},
}
For more examples and detailed documentation, see the Features page.
What's with the name?
There's really no very good synonyms for the verb, 'indent'. However, there are several for the act of creating a small dent in something. One of my favorites was 'snick'. It means "to cut a small notch or incision in". I think I'll use that!