Skip to main content

PRINTYFUL - You CLI application more beautiful!

Developed to improve the user experience in Python terminal applications, seeking simplicity of use and efficiency of applying beautiful decorations and loading screens to your application!

How to use

Printyful is based on execution engines, where each engine has its own responsibility (inheriting executions from other engines) and is included in a final engine called FullMotor. Using this engine it will be possible to create decorated titles, panels, loading screens and other currently available decorations.

Usage example:

from printyful import FullMotor

motor = FullMotor()

title = motor.panel_title('Your life is great')
print(title)

motor.loading_bar(message='Downloading...', sleeptime=0.4 , final_text='100% (COMPLETE)')

Available Motors

1. ColorMotor

Responsible for styling terminal text using ANSI color codes.

Method Description
red_text(text) Displays text in red.
blue_text(text) Displays text in blue.
green_text(text) Displays text in green.
yellow_text(text) Displays text in yellow.

Example:

from printyful import ColorMotor

color = ColorMotor()

print(color.red_text("Error!"))
print(color.green_text("Operation successful!"))
print(color.blue_text("Information"))
print(color.yellow_text("Warning!"))

2. BackgroudColorMotor

Inherits all features from ColorMotor and adds methods for applying background colors to terminal text.

Method Description
red_background(text) Applies a red background.
blue_background(text) Applies a blue background.
green_background(text) Applies a green background.
yellow_text(text) Applies a yellow background.

Example:

from printyful import BackgroudColorMotor

background = BackgroudColorMotor()

print(background.red_background(" ERROR "))
print(background.green_background(" SUCCESS "))
print(background.blue_background(" INFO "))

3. StylesMotor

Inherits the previous motors and introduces additional text formatting options.

Method Description
bold_text(text) Makes text bold.
sublime_text(text) Underlines text.
invert_text(text) Inverts text and background colors.

Example:

from printyful import StylesMotor

styles = StylesMotor()

print(styles.bold_text("Important message"))
print(styles.sublime_text("Underlined text"))
print(styles.invert_text("Inverted text"))

4. PanelMotor

Responsible for creating visual panels and option lists directly in the terminal.

Initialization parameter:

Parameter Type Default Description
title_color str '0' ANSI color code used for panel titles.

Methods:

Method Description
panel_title(title) Creates a visual panel containing a title. Requires at least 8 characters.
panel_list_options_enumerated(options) Generates an automatically numbered option list.
panel_list_options(options) Generates an option list with custom identifiers.

Example:

from printyful import PanelMotor

panel = PanelMotor(title_color='34')

print(panel.panel_title("PRINTYFUL"))

options = ["Start", "Settings", "Exit"]
print(panel.panel_list_options_enumerated(options))

custom_options = [
    ("A", "Start"),
    ("B", "Settings"),
    ("C", "Exit")
]

print(panel.panel_list_options(custom_options))

5. LoadingMotor

Inherits all previous functionalities and introduces loading animations for terminal applications.

Method: loading_text()

Displays a text-based loading animation using progressively increasing dots.

Parameter Type Default Description
text str 'Loading' Text displayed during the animation.
multiplier int 3 Maximum number of dots.
sleeptime float 0.8 Time interval between updates, in seconds.
await_confirm bool False Waits for user confirmation after completion.

Example:

from printyful import LoadingMotor

loading = LoadingMotor()

loading.loading_text(
    text="Initializing",
    multiplier=5,
    sleeptime=0.5,
    await_confirm=True
)

Method: loading_bar()

Creates a percentage-based loading bar with dynamically changing colors.

Parameter Type Default Description
multiplier int 100 Maximum progress value.
sleeptime float 0.8 Time interval between updates.
colors List[str] ['31', '33', '32'] ANSI color codes used by the progress bar.
await_confirm bool False Waits for user confirmation after completion.
final_text str '' Additional text displayed beside the progress bar.
message str '' Message displayed during the loading process.

Color transitions are determined by the current progress:

  • 0%–49%: First color.
  • 50%–79%: Second color.
  • 80%–100%: Third color.

Example:

from printyful import LoadingMotor

loading = LoadingMotor()

loading.loading_bar(
    multiplier=100,
    sleeptime=0.05,
    colors=['31', '33', '32'],
    message="Installing dependencies...",
    final_text="Installation",
    await_confirm=True
)

6. FullMotor

FullMotor combines all previously introduced motors into a single class.

It is the most complete option in the library, providing access to text colors, background colors, formatting, panels, and loading animations through a single instance.

Initialization parameter:

Parameter Type Default Description
title_color str '0' ANSI color code used for panel titles.

Example:

from printyful import FullMotor

motor = FullMotor(title_color='34')

# Text colors
print(motor.red_text("Error"))
print(motor.green_text("Success"))

# Background colors
print(motor.blue_background("Information"))

# Text styles
print(motor.bold_text("Important"))

# Panels
print(motor.panel_title("MY APPLICATION"))

# Loading animations
motor.loading_text("Starting", sleeptime=0.3)

Motor Inheritance Structure

Printyful uses an inheritance-based architecture, allowing each motor to reuse and extend the functionalities of its predecessor.

ColorMotor
    |
    v
BackgroudColorMotor
    |
    v
StylesMotor
    |
    v
PanelMotor
    |
    v
LoadingMotor
    |
    v
FullMotor

Installation

pip install printyful

Additional Notes

  • Colors and text formatting are implemented using ANSI escape sequences.
  • Loading animations use time.sleep() to control animation speed.
  • Terminal clearing uses the clear command, primarily targeting Linux and Unix environments.
  • Each motor can be imported and instantiated independently. Using FullMotor is optional.

Printyful — Make your terminal more expressive.

Metadata

Release files for printyful 1.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 printyful 1.2
File Size Uploaded Provenance Actions
printyful-1.2.tar.gz 4.5 kB Without provenance Details for printyful-1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for printyful 1.2
File Interpreter ABI Platform Actions
printyful-1.2-py3-none-any.whl Python 3 none any Details for printyful-1.2-py3-none-any.whl

Total release size: 9.2 kB

Release files / printyful-1.2.tar.gz

Download URL printyful-1.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ba5039516725203c4e2ab1aa0794d097747358967a85e0cf0b149c1fe40c2db5
BLAKE2b-256 checksum
How to use checksums
ed17d639bfaf8057ecf60d2956554b4bc5f2a45b9e8fdfa44822e3612e8b08b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / printyful-1.2-py3-none-any.whl

Download URL printyful-1.2-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d6b0f7ba27b6cfcfb49f47f50287285ed386626ce84474ef19e49099fbc2c28
BLAKE2b-256 checksum
How to use checksums
92c5c9f6fb99bb181ecd963662f9bf2cc28e85222b63acf5db680fe91165be7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for printyful 1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files No provenance

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