Skip to main content

terminal formatter

The Terminal Formatter Library provides a few easy-to-use functions for formatting terminal-printed text with custom functions and wrappers for pprintpp and colored. This library is mostly intended for personal use and might introduce breaking changes at any point.

With this library, you can:

  • Highlight text
  • Wrap text inside a box to have it stand out even in large amounts of output
  • Pretty-print data structures
  • Indent blocks of text
  • Colorize text and backgrounds for colored terminal printing

installation

The library can be installed with

pip install terminal-formatter

It then can be imported in your script with

import terminal-formatter

available functions

heading(text: str) -> str - Formats headings, shortcut for box() inside highlight() function.

highlight(text: str) -> str - Highlight text by changing its color to orange_1.

box(text: str) -> str - Wraps text inside a box of # characters to have it stand out of even large amounts of output.

pretty(obj) -> str - Prettyprint a data structure - wraps pprintpp's format function.

indent(text: str, amount: int = 1, indent_character: str = ' ') -> str - Indent text by increments of four.

colorize(text: str, color: str) -> str - Colorize given text for colored terminal printing.

colorize_bg(text: str, color: str) -> str - Colorize given text's background for colored terminal printing.

license

This library is licensed under the MIT License. See the LICENSE file for details.

Release files for terminal-formatter 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for terminal-formatter 0.0.2
File Size Uploaded
terminal-formatter-0.0.2.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for terminal-formatter 0.0.2
File Interpreter ABI Platform
terminal_formatter-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / terminal-formatter-0.0.2.tar.gz

Download URL terminal-formatter-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cd296df64b45a8e5a1759b41f0358f3b98c943891992d523730a19ab37552511
BLAKE2b-256 checksum
How to use checksums
3ead012becdb737b68f65362ed3c53dbe311862fbd99b5e6cd204574cfa174bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / terminal_formatter-0.0.2-py3-none-any.whl

Download URL terminal_formatter-0.0.2-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2377d2a230679cf67a16c1d102bad43aa1fe644bf0f34b1f196941b1f6191a3
BLAKE2b-256 checksum
How to use checksums
331028a349bc5cce0f80358ec0aa59e81e97bb4bcc8bdcfffc2fdd8c719abe7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page