Console tool (Animate / Print with color / Format / etc...)
Project description
๐ฆ Jarbin-ToolKit:Console v0.1.2.3
Structured terminal interface system providing unified console I/O, ANSI control, text formatting, and animation rendering through a modular Python API
๐น Short Description
Jarbin-ToolKit Console is a structured terminal abstraction library that unifies console I/O, ANSI sequence generation, text formatting, and animation rendering into a modular, deterministic Python interface.
It provides:
- unified console input/output with format control
- full ANSI sequence generation (color, cursor, line)
- text and animation object model
- progress bar and spinner rendering system
- terminal size and cursor position introspection
It is not a TUI framework, but a structured terminal I/O and rendering abstraction layer.
๐น Authors
- Nathan (Jarjarbin06)
- Jarbin Studio
๐น License
GPL v3
๐น Target Audience
This library is intended for:
- Python developers building CLI tools requiring structured output
- developers designing terminal-based interfaces or debug consoles
- projects requiring deterministic ANSI color and cursor control
- engineers building animated terminal feedback systems (progress bars, spinners)
๐น Platform Support
- Python โฅ 3.10
- Linux / Windows / macOS compatible
- Terminal introspection features (cursor, key press) require a live TTY (not available in piped or non-interactive environments)
๐น Purpose
Jarbin-ToolKit Console aims to:
- abstract terminal I/O behind a unified
Consoleinterface - generate ANSI sequences in a structured and composable way
- provide a text object model enabling formatting via method chaining
- render frame-based animations and progress bars in a deterministic model
- expose terminal metadata (size, cursor position) in a safe, cross-platform manner
It is not a curses replacement, but a modular terminal control and rendering toolkit.
๐น Key Features
- Unified
Consolestatic interface for all terminal I/O - ANSI sequence generation via composable
ANSIandColorobjects - Cursor manipulation through
Cursor(move, hide, show, save, restore) - Line manipulation through
Line(clear, erase, restore) Textobject with format chaining (bold,italic,underline,error,warning, etc.)Animationobject with step-based frame renderingProgressBarobject with percent tracking, spinner integration, and style customizationSpinnerfactory for standalone spinner animationsStyleobject for configuring animation visual characters- Base animation packs (
BasePack) for Animation and ANSI ready-to-use presets - Alternate screen entry and exit support
- Terminal size and cursor position introspection
- Configurable via
Setting(banner, log mode, debug, safe mode) - Optional log file integration
๐น Architecture Overview
User Code
โ
โผ
Console (static interface)
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ โผ
Text System ANSI System
โ โ
โโโ Text โโโ ANSI
โโโ Format (base) โโโ Color
โโโ Cursor
โโโ Line
โ โ
โผ โผ
Animation System System
โ โ
โโโ Animation โโโ Setting
โโโ ProgressBar โโโ Log
โโโ Spinner โโโ Config
โโโ Style โโโ Time / StopWatch
โโโ BasePack โโโ Error
โ
โผ
Terminal Rendering Output
๐น Core Concept
The system is organized around a static Console class that serves as the entry point for all terminal operations. All subsystems are independently usable but designed to compose through a shared object model.
Console
Central static interface to the terminal:
Console.print(*value, separator, start, end, file, auto_reset, cut, sleep)
Console.input(msg, separator, wanted_type)
Console.get_key_press()
Console.get_cursor_position()
Console.get_size()
Console.flush(stream)
Console.enter_alternate_screen(hide_cursor)
Console.exit_alternate_screen(show_cursor)
Exposes stdin, stdout, and stderr as class properties.
ConsoleMeta implements :
__len__to return the current terminal column width.__enter__and__exit__to open and close automatically the alternate screen usingwith Console: ...
Text
Wraps a string with composable format methods:
text = Text("Hello").bold().underline().error()
Inherits from Format, which provides all formatting operations as instance methods. Compatible with ANSI, Animation, and str through __add__.
ANSI
Wraps an ANSI escape sequence as a composable object:
seq = ANSI(f"{ANSI.ESC}31m")
Composable with Text, Animation, ProgressBar, and str via __add__. All ANSI subsystems return ANSI objects.
Color
Generates ANSI color sequences from preset constants or raw values:
Color(Color.C_FG_RED)
Color.rgb_fg(0, 145, 211)
Color.color_bg(42)
Instantiation via __new__ directly returns an ANSI object.
Animation
Frame-based animation container:
anim = Animation(["frame1", "frame2", "frame3"])
anim.update()
str(anim)
Supports composition via +, step tracking, auto-reset, and direct indexing.
ProgressBar
Percent-driven animation renderer:
bar = ProgressBar(length=20, style=Style(...), spinner=Spinner.stick())
bar.update(50)
bar.render(delete=True)
Configurable percent style (num, bar, mix), percent position (b/a), and spinner position.
๐น API / Function Documentation
๐น Console
| Name | Description |
|---|---|
print |
Print formatted output with ANSI, cut, and sleep support |
input |
Read typed user input with type coercion |
get_key_press |
Wait and return a single raw key press |
get_cursor_position |
Return current cursor (row, col) position |
get_size |
Return terminal (width, height) dimensions |
flush |
Flush a given output stream |
enter_alternate_screen |
Switch to alternate terminal screen |
exit_alternate_screen |
Return from alternate terminal screen |
execute |
Execute a shell command via os.system |
stdin |
Class property: sys.stdin |
stdout |
Class property: sys.stdout |
stderr |
Class property: sys.stderr |
๐น Text
| Name | Description |
|---|---|
__init__ |
Wraps a string, list, or ANSI into a Text |
__add__ |
Concatenates with another Text, ANSI, or str |
__mul__ |
Repeats the text n times |
__str__ |
Returns raw string value |
__len__ |
Returns character count |
s |
Property alias for __str__ |
url_link |
Generates a terminal hyperlink sequence |
file_link |
Generates a JetBrains file navigation link |
๐น Format (inherited by Text, Animation, ProgressBar)
| Name | Description |
|---|---|
reset |
Apply ANSI reset sequence |
bold |
Apply bold format |
italic |
Apply italic format |
underline |
Apply underline format |
dim |
Apply dim format |
hide |
Apply hidden format |
strikethrough |
Apply strikethrough format |
error |
Apply error color (title or body variant) |
warning |
Apply warning color (title or body variant) |
valid |
Apply valid/success color |
debug |
Apply debug color |
info |
Apply info color |
critic |
Apply critical color |
apply |
Static: apply any ANSI sequence to any object |
tree |
Static: format a dict/list as a bash-style tree |
module_tree |
Static: return the module's tree representation |
๐น ANSI
| Name | Description |
|---|---|
__init__ |
Wraps a raw ANSI sequence string or list |
__add__ |
Concatenates with ANSI, Text, Animation, or str |
__mul__ |
Repeats the sequence n times |
__str__ |
Returns the raw ANSI string |
__len__ |
Returns sequence string length |
s |
Property alias for __str__ |
ESC |
Class constant: "\x1b[" |
๐น Color
| Name | Description |
|---|---|
color |
Generate ANSI sequence from preset C_* constant |
color_fg |
Generate 256-color foreground sequence |
color_bg |
Generate 256-color background sequence |
rgb_fg |
Generate RGB foreground sequence |
rgb_bg |
Generate RGB background sequence |
epitech_fg |
Epitech brand foreground color (rgb(0, 145, 211)) |
epitech_bg |
Epitech brand background color |
epitech_dark_fg |
Epitech dark foreground color (rgb(31, 72, 94)) |
epitech_dark_bg |
Epitech dark background color |
๐น Cursor
| Name | Description |
|---|---|
up |
Move cursor up n lines |
down |
Move cursor down n lines |
left |
Move cursor left n columns |
right |
Move cursor right n columns |
top |
Move cursor to top-left corner |
previous |
Move to beginning of n-th previous line |
next |
Move to beginning of n-th next line |
move |
Move to absolute (row, col) position |
move_column |
Move to absolute column x |
set |
Save current cursor position |
reset |
Restore saved cursor position |
show |
Make cursor visible |
hide |
Make cursor invisible |
๐น Line
| Name | Description |
|---|---|
clear_line |
Erase entire current line |
clear_start_line |
Erase from start of line to cursor |
clear_end_line |
Erase from cursor to end of line |
clear_screen |
Erase entire screen |
clear |
Erase screen and move cursor to top-left |
clear_previous_line |
Erase n previous lines and reposition cursor |
๐น Animation
| Name | Description |
|---|---|
__init__ |
Build animation from list or \-delimited string |
__add__ |
Compose with another Animation, Text, ANSI, or str |
__getitem__ |
Access frame by index (clamped to last frame) |
__str__ |
Return current frame as string |
__call__ |
Advance one step |
__len__ |
Return total frame count |
update |
Advance step with optional auto-reset |
render |
Return current frame string with optional line erase |
is_last |
Return whether current step is the last frame |
reset |
Reset step counter to 0 |
๐น ProgressBar
| Name | Description |
|---|---|
__init__ |
Build progress bar with length, style, spinner, options |
__getitem__ |
Return frame at given percent index |
__str__ |
Render full progress bar string with spinner and percent |
__call__ |
Increment percent by 1 |
update |
Set percent value and optionally advance spinner |
render |
Return renderable string with optional line deletion |
๐น Spinner
| Name | Description |
|---|---|
stick |
Rotating stick spinner (-, \, |, /) |
plus |
Alternating plus spinner (-, |) |
cross |
Alternating cross spinner (/, \) |
๐น Style
| Name | Description |
|---|---|
__init__ |
Define on, off, arrow_left, arrow_right, border_left, border_right characters |
__str__ |
Return semicolon-separated key=value string |
__repr__ |
Return constructor-style representation |
๐น BasePack (Animation)
Pre-built animation sequences updated via BasePack.update(style):
| Name | Description |
|---|---|
P_SLIDE_R |
Single cell sliding right |
P_SLIDE_L |
Single cell sliding left |
P_SLIDER_R |
Multi-cell slider moving right |
P_SLIDER_L |
Multi-cell slider moving left |
P_FILL_R |
Bar filling from left |
P_FILL_L |
Bar filling from right |
P_EMPTY_R |
Bar emptying toward right |
P_EMPTY_L |
Bar emptying toward left |
P_FULL |
Static full bar |
P_EMPTY |
Static empty bar |
๐น BasePack (ANSI)
Pre-built color tuples updated via BasePack.update():
| Name | Description |
|---|---|
P_CRITIC |
Critical severity color pair |
P_ERROR |
Error severity color pair |
P_WARNING |
Warning severity color pair |
P_VALID |
Success/valid color pair |
P_DEBUG |
Debug color pair |
P_INFO |
Informational color pair |
๐น Project Structure
jarbin_toolkit_console/
โโโ console.py
โโโ __init__.py
โโโ Animation/
โ โโโ animation.py
โ โโโ basepack.py
โ โโโ progressbar.py
โ โโโ spinner.py
โ โโโ style.py
โ โโโ __init__.py
โโโ ANSI/
โ โโโ ansi.py
โ โโโ basepack.py
โ โโโ color.py
โ โโโ cursor.py
โ โโโ line.py
โ โโโ __init__.py
โโโ Text/
โ โโโ text.py
โ โโโ format.py
โ โโโ __init__.py
โโโ System/
โโโ setting.py
โโโ __init__.py
๐น Usage
๐น Basic Print
from jarbin_toolkit_console import Console
Console.print("Hello, world!")
Console.print("Truncated output to terminal size", cut=True)
Console.print("Delayed continuity", sleep=1.5)
๐น Formatted Text
from jarbin_toolkit_console import Text, Console
msg = Text.Text("Build failed").bold().error()
Console.print(msg)
๐น ANSI Color
from jarbin_toolkit_console import ANSI, Console
red = ANSI.Color.rgb_fg(200, 50, 50)
reset = ANSI.Color(ANSI.Color.C_RESET)
Console.print(f"{red}Error{reset}: something went wrong")
๐น Cursor Control
from jarbin_toolkit_console import ANSI, Console
Console.print(ANSI.Cursor.hide(), end="")
Console.print(ANSI.Cursor.move(5, 10), end="")
Console.print("positioned text", end="")
Console.print(ANSI.Cursor.show(), end="")
๐น Animation
from jarbin_toolkit_console import Animation, Console
anim = Animation.Animation(["[ ]", "[- ]", "[-- ]", "[---]"])
for _ in range(8):
Console.print(anim.render(delete=True), sleep=0.2)
anim.update()
๐น Progress Bar
from jarbin_toolkit_console import Animation, ANSI, Console
bar = Animation.ProgressBar(20, spinner=Animation.Spinner.stick())
for i in range(101):
bar.update(i, update_spinner=not(i % 6))
Console.print(bar.render(hide_spinner_at_end = True) + " " + ANSI.Cursor.previous(), sleep=0.02)
Console.print()
๐น Alternate Screen
from jarbin_toolkit_console import Console
with Console:
Console.print("Running in alternate screen...", sleep=2)
๐น Initialization
import jarbin_toolkit_console as jtc
jtc.init(banner=True)
# ... use the library
jtc.quit()
๐น Build / Installation
Installation
pip install jarbin-toolkit-console
๐น Execution Behavior
- All
Consolemethods are strictly static โ no instance required - ANSI sequences are generated lazily at call time โ no pre-computation
AnimationandProgressBarrendering is frame-driven and manual โ no background threadsget_key_pressandget_cursor_positionrequire a live TTY โ return safe defaults otherwiseConsole.printalways returns the final renderedTextobjectSetting.update()is called at module import โ all subsystems self-initialize
๐น Memory Model
Consoleholds no state โ all operations are stateless static callsText,ANSI, andAnimationare immutable by composition โ operators always return new objectsAnimationandProgressBarmaintain internal mutable step/percent stateSettingmaintains global configuration as class-level attributes โ shared across all imports- No heap allocation outside standard Python object creation
๐น Design Philosophy
- static interface over instantiation for console operations
- composable object model for all output types
- explicit ANSI generation โ no implicit terminal state assumption
- safe fallback behavior for non-TTY environments
- modular subsystems with no circular runtime dependencies
- deterministic rendering โ output is a function of state only
๐น Current State
โ ๏ธ Core interface is stable and functional
Status:
- Console I/O fully implemented
- ANSI color, cursor, and line control fully implemented
- Text and Format system fully implemented
- Animation and ProgressBar system fully implemented
- Spinner factory implemented
- BasePack presets implemented for Animation and ANSI
- Setting and configuration system implemented
Limitations:
get_key_pressandget_cursor_positionunavailable in non-TTY environmentscutoption inConsole.printdoes not handle ANSI sequences correctlycutdoes not adapt dynamically on terminal resize- No async rendering support
- No layout or grid system
๐น Limitations
- TTY-dependent features fail silently in piped or headless environments
cut=TrueinConsole.printproduces incorrect results with ANSI sequencesProgressBarandAnimationrendering assumes single-line output- No built-in thread safety for shared
AnimationorProgressBarstate Settingis global and shared โ not suitable for isolated multi-context use
๐น Extension / Contribution
Possible extensions:
- async-compatible animation renderer
- multi-line layout and grid rendering system
- TTY-safe ANSI stripping utility
- structured log output formatter built on
Format - theme system layered on
ColorandBasePack
๐น Notes
This library is designed as a structured terminal I/O and rendering toolkit, not a full terminal UI framework.
It prioritizes:
- modularity between subsystems
- explicit and composable output construction
- deterministic rendering without hidden terminal state
๐น Identity Summary
Jarbin-ToolKit Console is:
- a structured terminal I/O abstraction layer
- a composable ANSI sequence generation system
- a deterministic animation and progress rendering toolkit
- a modular, extensible terminal control library
๐น Final Rule
If output behavior is not explicitly constructed, it does not exist.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jarbin_toolkit_console-0.1.2.3.tar.gz.
File metadata
- Download URL: jarbin_toolkit_console-0.1.2.3.tar.gz
- Upload date:
- Size: 58.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ea468770b8eb5d470a8d011304371112425832c807d59595a3c9e2bc5fc3b08
|
|
| MD5 |
63168c1ef6d74e949aba052cf3262143
|
|
| BLAKE2b-256 |
d6f1fea1c1dd109da7ca038232d34d1342b88866bbc7cb8aa4bfba8c72544654
|
File details
Details for the file jarbin_toolkit_console-0.1.2.3-py3-none-any.whl.
File metadata
- Download URL: jarbin_toolkit_console-0.1.2.3-py3-none-any.whl
- Upload date:
- Size: 42.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2c5ecc3722a5d7257ce3080b135cdf9e40a42438b66321352ca33047261e459
|
|
| MD5 |
1f8387c37e6e946080861fc540084031
|
|
| BLAKE2b-256 |
45ffd5e3fb3d26f039b2ef7c03bedecdb4963d47f2b574b4895ce609bd8a5b35
|