Skip to main content

Various printing utilities and helpers/extenders for the `rich` package.

Project description

printbuddies

Various printing utilities and helpers/extenders for the rich package.
Install with:

pip install printbuddies

print_in_place

'print_in_place' erases the current line in the terminal and then writes the value of the 'string' param to the terminal.

from printbuddies import print_in_place
import time
#This will print numbers 0-99 to the terminal with each digit overwriting the last.
for i in range(100):
    print_in_place(i)
    time.sleep(0.1)

Tag

The Tag class is essentially a wrapper to shorten using rich tags.
When a Tag is casted to a string it is formatted with surrounding square brackets and the o or off properties can be accessed to return the matching closing tag.

from printbuddies import Tag
p = Tag("pale_turquoise4")
c = Tag("cornflower_blue")
s = f"{p}This{p.o} {c}is{c.o} {p}a{p.o} {c}string"

is equivalent to

s = "[pale_turquoise4]This[/pale_turquoise4] [cornflower_blue]is[/cornflower_blue] [pale_turquoise4]a[/pale_turquoise4] [cornflower_blue]string"

The ColorMap class contains two Tag properties for each named color (except shades of grey, those only have a full name property): one that's the full name of the color and one that's an abbreviated name, for convenience.

This is useful for seeing color options using autocomplete:

The class also supports iterating over the tags as well as selecting random colors:


The Gradient class inherits from list and can be used to easily apply an arbitrary number of color sweeps across text:

The Progress class and track function are the same as the rich versions, just with different default colors and columns.
TimerColumn is a subclass of rich.progress.TimeRemainingColumn that displays {time_elapsed}<->{time_remaining} with a color gradient.
The progress bar and task progress columns with the altered default can be obtained with get_bar_column() and get_task_progress_column, respectively.

Default columns and colors of this version:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

printbuddies-2.0.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

printbuddies-2.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file printbuddies-2.0.0.tar.gz.

File metadata

  • Download URL: printbuddies-2.0.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for printbuddies-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7a9fc8bb9666bd6b89f95b9614a8d93ed5f6423438e4c9202d20c411be0f459d
MD5 9cfc24fa4bbc25966ca4d21e41f097d2
BLAKE2b-256 9133199d138025969f131f59d8b100a7c6474a600ab73a86b50f5eeb53593534

See more details on using hashes here.

Provenance

File details

Details for the file printbuddies-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: printbuddies-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for printbuddies-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71d95cd3a18b0394ef5ff5e701691fda18579822430a4a57b2e9268737608b25
MD5 7eb0d45b8ea604f72a7b911490d563ee
BLAKE2b-256 5a157b29c4b7a6fdb8596cbd83b152ab6bb4c664a9d929c5fe34f5cca1177d85

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page