Console tool (Animate / Print with color / Format / etc...)
Project description
Jarbin-ToolKit:Console v0.1.2.0
Latest development version
🟠 UNDER DEVELOPMENT 🟠 None 🟠Latest release
🟢 RELEASED 🟢 v0.1.2.0 🟢Description
jarbin-toolkit:console is a Python library designed to help you create enhanced terminal interfaces. It's improving the appearance and readability of your command-line interface with lightweight animations, colorful text, and neat formatting. If you want to make your terminal programs more readable and visually structured, this library is for you!
Table of Contents
- Description
- Features
- Tech Stack
- Installation
- Usage
- Project Structure
- API Reference
- Release Notes
- License
- Important Links
- Footer
Features
- Cool Text Effects: Easily add colors, bold text, italics, underlines, and even strike through to your terminal text.
- Animations: Display simple animations. Useful for loading indicators or status displays.
- Progress Bars: Show the progress of long tasks with customizable progress bars. Provides clear and configurable visual feedback.
- Cursor Control: Provides methods to move, show, and hide the cursor.
- Line Control: Features for clearing lines or the entire screen.
- ANSI Escape Sequence Handling: Provides classes for generating ANSI escape sequences to control text color, formatting, and cursor movement.
Tech-Stack
- Language: Python - Chosen for its readability and versatility.
- Frameworks: Python - Entirely implemented in Python.
Installation
To begin , install jarbin-toolkit:console:
Prerequisites:
Make sure you have Python 3.11 or newer installed on your computer.
You can check your Python version by opening a terminal and typing python --version.
Install from PyPI (recommended):
Open your terminal and run this command:
pip install jarbin_toolkit_console
This will automatically download and install the library from PyPI.
Install from GitHub:
If you want the latest version directly from the source, you can install it using git:
git clone -b latest NONE
make -C lib/jarbin_toolkit_console install
This downloads the code, then the install script handles the installation.
These commands install the jarbin-toolkit:console package and its dependencies (datetime).
Usage
Here are some examples demonstrating how to use jarbin-toolkit:console:
Basic Text Formatting
from jarbin_toolkit_console import *
API-Reference
Animation
-
Animation: Step-based console animation handler.
Animation(animation: list[Any] | str = "")Create an animation from a list of steps or a"\\"-separated string.update(auto_reset: bool = True) -> NoneAdvance to next animation step.auto_reset: reset automatically at last step
render(color: ANSI | int = RESET, delete: bool = False) -> strRender current step.color: ANSI color or color codedelete: move cursor up after rendering
is_last() -> boolReturnTrueif animation reached final step.reset() -> NoneReset animation to first step.__call__() -> NoneShortcut forupdate().__len__() -> intReturn number of steps.__getitem__(index: int) -> strReturn step at given index.__str__(color: ANSI = RESET) -> strReturn colored current frame.__add__(other) -> AnimationMerge with another Animation or compatible object.__repr__() -> strConstructor-style representation.
-
BasePack: Predefined animation packs for bars and sliders.
- Class attributes (after
update()):P_SLIDE_R,P_SLIDE_LP_SLIDER_R,P_SLIDER_LP_FILL_R,P_FILL_LP_EMPTY_R,P_EMPTY_LP_FULL,P_EMPTY
update(style: Style) -> None(staticmethod) Initialize all predefined animation sequences using given style.
- Class attributes (after
-
ProgressBar: Animated and customizable console progress bar.
ProgressBar(length: int, *, animation: Animation | None = None, style: Style = default, percent_style: str = "bar", spinner: Animation | None = None, spinner_position: str = "a")Create a progress bar.length: bar lengthanimation: custom Animationstyle: Style objectpercent_style:"bar" | "num" | "mix"spinner: optional spinner animationspinner_position:"a"(after) or"b"(before)
update(percent: int = 0, update_spinner: bool = True, auto_reset: bool = True) -> NoneUpdate bar percentage and optionally spinner.render(color: ANSI | tuple = RESET, hide_spinner_at_end: bool = True, delete: bool = False) -> TextRender progress bar.color: single ANSI or tuple (bar, spinner, percent)hide_spinner_at_end: hide spinner at 100%delete: clear previous line
__call__() -> NoneIncrement percentage by 1.__getitem__(index: int) -> strGet animation frame.__str__(color: tuple = RESET, hide_spinner: bool = False) -> strString representation.__repr__() -> strConstructor-style representation.
-
Spinner: Predefined spinner animations.
stick(style: Style = default) -> Animation(staticmethod) Rotating stick spinner (- \ | /).plus(style: Style = default) -> Animation(staticmethod) Plus-style spinner (- |).cross(style: Style = default) -> Animation(staticmethod) Cross-style spinner (/ \).
-
Style: Visual configuration for animations and progress bars.
-
Style(on: str = "#", off: str = "-", arrow_left: str = "<", arrow_right: str = ">", border_left: str = "|", border_right: str = "|")Create a style configuration.on: filled characteroff: empty characterarrow_left: left arrowarrow_right: right arrowborder_left: left borderborder_right: right border
-
__str__() -> strReturn formatted style description. -
__repr__() -> strConstructor-style representation.
-
ANSI Module
-
ANSI: Tool for handling ANSI sequences (inherits
Format).ESC: str– ANSI escape sequence starter (\x1b[).__init__(sequence: list[Any|str] | Any | str = "")Initialize an ANSI sequence.__add__(other: Any) -> ANSIConcatenate with anotherANSI/Text/Animation/ProgressBar/StopWatch/strobject.__mul__(other: int) -> ANSIRepeat ANSI sequenceothertimes.__str__() -> strConvert to string.__len__() -> intLength of sequence.__repr__() -> strRepresentation asANSI(...).
-
BasePack: Ready-to-use ANSI animation/color pack.
P_ERROR: tuple[ANSI|str, ANSI|str]P_WARNING: tuple[ANSI|str, ANSI|str]P_VALID: tuple[ANSI|str, ANSI|str]P_INFO: tuple[ANSI|str, ANSI|str]update() -> NoneInitialize colors usingColorclass.
-
Color: ANSI coloring system.
- Standard attributes:
C_RESET, C_BOLD, C_ITALIC, C_UNDERLINE, C_FLASH_SLOW, C_FLASH_FAST, C_HIDDEN, C_STRIKETHROUGH - Foreground colors:
C_FG_DARK, C_FG_DARK_GREY, ..., C_FG_WHITE - Background colors:
C_BG, C_BG_DARK_GREY, ..., C_BG_WHITE __new__(*args) -> ANSI– callsColor.color().color(color: Any|str|int) -> ANSI– get ANSI sequence for a color.color_fg(color: int) -> ANSI– foreground 0–255.color_bg(color: int) -> ANSI– background 0–255.rgb_fg(r: int, g: int, b: int) -> ANSI– RGB foreground.rgb_bg(r: int, g: int, b: int) -> ANSI– RGB background.epitech_fg() -> ANSI,epitech_bg() -> ANSI– Epitech theme colors.epitech_dark_fg() -> ANSI,epitech_dark_bg() -> ANSI– Epitech dark theme colors.
- Standard attributes:
-
Cursor: Control console cursor position.
up(n: int = 1) -> ANSI– move cursor up.down(n: int = 1) -> ANSI– move cursor down.left(n: int = 1) -> ANSI– move cursor left.right(n: int = 1) -> ANSI– move cursor right.top() -> ANSI– move to top-left corner.previous(n: int = 1) -> ANSI– beginning of previous line.next(n: int = 1) -> ANSI– beginning of next line.move(y: int = 0, x: int = 0) -> ANSI– move to column x, row y.move_column(x: int = 0) -> ANSI– move to column x.set() -> ANSI– save cursor position.reset() -> ANSI– return to saved position.show() -> ANSI– show cursor.hide() -> ANSI– hide cursor.
-
Line: Manage console lines and screen.
clear_line() -> ANSI– clear current line.clear_start_line() -> ANSI– clear from start to cursor.clear_end_line() -> ANSI– clear from cursor to end.clear_screen() -> ANSI– clear entire screen.clear() -> ANSI– clear screen and move cursor to top-left.clear_previous_line(n: int = 1) -> ANSI– clear previous line(s).
Setting
- Setting: Module-wide configuration and environment handler.
SettingHolds all module settings, package information, and system references.S_OS: str | NoneOperating system name ("Windows","Linux", etc.).S_CONFIG_FILE: Config | NoneConfiguration file object.S_LOG_FILE: Log | NoneLog file object.S_PACKAGE_PATH: strPath to the package.S_PACKAGE_NAME: strPackage name.S_PACKAGE_VERSION: strPackage version.S_PACKAGE_DESCRIPTION: strPackage description.S_PACKAGE_REPOSITORY: strPackage repository URL.S_SETTING_SHOW_BANNER: boolShow module banner.S_SETTING_AUTO_COLOR: boolEnable automatic color detection.S_SETTING_SAFE_MODE: boolEnable safe mode.S_SETTING_MINIMAL_MODE: boolEnable minimal mode.S_SETTING_DEBUG_MODE: boolEnable debug mode.S_SETTING_LOG_MODE: boolEnable logging.S_SETTING_OPENED_LOG: strName of currently opened log file.update() -> NoneInitialize system settings and load configuration.- Detects OS and sets
S_PACKAGE_PATH. - Loads configuration from
S_CONFIG_FILE. - Updates package metadata.
- Initializes logging if
S_SETTING_LOG_MODEis enabled.
- Detects OS and sets
Text
-
Format: Text and console formatting utility.
FormatBase class for applying ANSI-based formatting toText,Animation,ProgressBar,ANSIobjects, or strings.reset() -> AnyApply reset format.bold() -> AnyApply bold format.italic() -> AnyApply italic format.underline() -> AnyApply underline format.hide() -> AnyApply hidden format.strikethrough() -> AnyApply strikethrough format.error(title: bool = False) -> AnyApply error format; optionally for a title.warning(title: bool = False) -> AnyApply warning format; optionally for a title.valid(title: bool = False) -> AnyApply success/valid format; optionally for a title.info(title: bool = False) -> AnyApply info format; optionally for a title.apply(obj: Any, sequence: Any | None = None) -> Any(staticmethod) Apply a given ANSI sequence to an object (Text,Animation,ProgressBar,ANSI, orstr).tree(d: dict | str | list, title: str | None = None, indent: int = 0) -> str(staticmethod) Convert a dictionary, list, or string into a bash-style tree string.module_tree() -> str(staticmethod) Returns the full module tree formatted as a string.
-
Text: Enhanced string handling with formatting support.
Text(text: list[Any | str] | Any | str = "")Create aTextobject.- Accepts string, list of strings, or
ANSIobject.
- Accepts string, list of strings, or
__add__(other: Any | str) -> TextConcatenateTextwith anotherText,ANSI, or string.__mul__(other: int) -> TextRepeat theTextsequence.__str__() -> strConvertTextobject to string.__len__() -> intReturn the length of theTextstring.__repr__() -> strConstructor-style representation.url_link(url: str, text: str | None = None) -> Text(staticmethod) Format a clickable URL link (may not work in all consoles).file_link(path: str, line: int | None = None) -> Text(staticmethod) Format a clickable file link (supports JetBrains IDEs like CLion).
Console
-
ConsoleMeta: Metaclass for
Console.__len__() -> intReturn the width of the current terminal in columns (default 100 if unavailable).
-
Console: Console input/output utility.
execute() -> NonePlaceholder for executing code in the console (not implemented).print(*args, separator: str = " ", start: str = "", end: str = "\n", file: Any = stdout, auto_reset: bool = True, cut: bool = False, sleep: int | float | None = None) -> TextPrint formatted text to the console.*args: values to printseparator: string between valuesstart: prepended stringend: appended stringfile: file-like objectauto_reset: reset ANSI sequences automaticallycut: truncate output to terminal widthsleep: delay after printing- Returns:
Textobject of printed content
input(msg: str = "Input", separator: str = " >>> ", wanted_type: type = str) -> AnyPrompt user input from console.msg: message to displayseparator: string between message and inputwanted_type: type to convert input- Returns: user input of specified type
get_key_press() -> strWait for a key press and return it.- Handles single key and escape sequences.
get_cursor_position() -> tuple[int, int]Get current cursor position in the console as(row, col).get_size() -> tuple[int, int]Get current terminal size as(width, height).flush(stream: Any = stdout) -> NoneFlush output of the given stream.
Release-Notes
-
v0.1.1:
- [/] 1rst real release
-
v0.1.0:
- [UPDATE]
jarbin_toolkit_consoleupdate (removed unlinked sub-modules) - [INIT] add
epitech_consoleto jarbin-toolkit (renamedjarbin_toolkit_console)
- [UPDATE]
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Important-Links
Files
- Repository: https://github.com/Jarjarbin06/jarbin-toolkit
- PyPI: https://pypi.org/project/jarbin-toolkit-console/
Wiki
- Wiki (take a look): https://github.com/Jarjarbin06/jarbin-toolkit/wiki
- README (updated): https://github.com/Jarjarbin06/jarbin-toolkit/blob/main/lib/console/README.md
- GitHub: https://jarjarbin06.github.io/jarbin-toolkit/
Footer
- Repository: https://github.com/Jarjarbin06/jarbin-toolkit
- Author: Nathan Jarjarbin
- Contact: nathan.amaraggi@epitech.eu
⭐️ Like the project? Give it a star!
🐛 Found a bug? Report it in the issues!
last update :
PACKAGE = 2026/02/12 ;
README = 2026/02/12
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
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.0.tar.gz.
File metadata
- Download URL: jarbin_toolkit_console-0.1.2.0.tar.gz
- Upload date:
- Size: 62.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb68720de4c4d8d713ab8088d477f1328b7eed4e1573739e3792f33af61194f0
|
|
| MD5 |
cf51051aee802276dca77f7a09415edd
|
|
| BLAKE2b-256 |
7e20cb3c405ad35552969bf9b56d1c9452ea81ff87819630a2115e2c662de205
|
File details
Details for the file jarbin_toolkit_console-0.1.2.0-py3-none-any.whl.
File metadata
- Download URL: jarbin_toolkit_console-0.1.2.0-py3-none-any.whl
- Upload date:
- Size: 41.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc02e6b6ba4f6f566fc3bf105577f90eb105e51dc23de645a7854e4bf52aacfb
|
|
| MD5 |
660ecdd87222fc6b297aa5818352d676
|
|
| BLAKE2b-256 |
4349236924bf71213710347d0f6f922ee82b5571cbc7371d8b614765fc01228d
|