Skip to main content

Lightweight terminal utilities

Project description

tooly

Lightweight but powerful terminal utilities for Python developers.


Installation

pip install tooly-dev

Overview

tooly provides a collection of utilities to improve CLI applications:

  • Colored output
  • Interactive input & menus
  • Logging & debugging
  • Progress & visualization
  • System helpers
  • Scheduling & retries
  • File saves & temp tools
  • Data generation (lorem)

Quick Start

import tooly

colors = tooly.ColorSystem()
print(colors.info("Hello, Tooly!"))

Features

🎨 Colors & Text

colors = tooly.ColorSystem()

print(colors.info("Info"))
print(colors.success("Success"))
print(colors.error("Error"))

text = "Some interesting text"
print(colors.highlight(text, ["interesting"], "yellow"))

print(colors.indent("folder/", 0))
print(colors.indent("file.py", 1))

⌨️ Input & Interaction

userinput

name = tooly.userinput("Name: ", validator=str.isalpha)

menu

choice = tooly.menu(["Start", "Stop", "Exit"])

confirm

if tooly.confirm("Continue?"):
    pass

password

pwd = tooly.password("Password: ", confirm=True)

⏱️ Execution Helpers

typewrite

tooly.typewrite("Hello", delay=0.05)

measure

with tooly.measure("Task"):
    pass

spinner

with tooly.spinner("Loading"):
    pass

countdown

tooly.countdown(5)

🔍 Diff

tooly.diff_highlight(a, b, tooly.DiffMode.WORD)
tooly.diff_highlight(a, b, tooly.DiffMode.CHAR)
tooly.diff_highlight(a, b, tooly.DiffMode.LINE)

📊 Visualization

progress

for i in tooly.progress(range(100)):
    pass

sparkline

print(tooly.sparkline([1, 5, 3]))

calendar

tooly.calendar(title="Commits")

🧠 Logging

tooly.log.set_file("app.log")

tooly.log.info("Info")
tooly.log.success("Success")
tooly.log.warn("Warning")
tooly.log.error("Error")
tooly.log.debug("Debug")

🔁 Retry

@tooly.retry(attempts=3)
def fetch():
    pass

🔔 System & OS

cls

tooly.cls()

on_platform

tooly.on_platform(windows=lambda: "win")

notify

tooly.notify("Title", "Message")

📦 Files & Environment

env

url = tooly.env("DATABASE_URL", required=True)

run

tooly.run("ls -la")

tempdir

with tooly.tempdir() as tmp:
    pass

💾 Saves (Persistence)

# save
tooly.saves.save("test", data)

# load
data = tooly.saves.load("test")

# exists
tooly.saves.exists("test")

# delete
tooly.saves.delete("test")

# list
tooly.saves.list()

# info
tooly.saves.info("test")

# find
tooly.saves.find("test")

# clear all
tooly.saves.clear()

📈 Humanize

tooly.humanize(1500000, "bytes")
tooly.humanize(3600, "seconds")

🧪 Data Generation (Lorem)

lorem = tooly.Lorem()

lorem.words(10)
lorem.sentences(3)
lorem.paragraph(5)

lorem.name()
lorem.email()
lorem.phone()

⏰ Scheduler

@tooly.every(seconds=2)
def job():
    print("tick")

Control:

job.stop()
job.pause()
job.resume()

🎬 Recorder

with tooly.recorder("session.log"):
    print("recorded")

📺 Watch

def get_time():
    return "time"


tooly.watch(get_time, interval=1)

🎨 Banner

tooly.banner("Tooly")

License

MIT

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

tooly_dev-1.5.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tooly_dev-1.5.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file tooly_dev-1.5.0.tar.gz.

File metadata

  • Download URL: tooly_dev-1.5.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for tooly_dev-1.5.0.tar.gz
Algorithm Hash digest
SHA256 9b899d43169541f3958da24d4c1d96d6b3bf5ee4248244e61ffd160979f6ea50
MD5 88d649fce8518dfd315a078cc210942b
BLAKE2b-256 8ee046e5ee2b02e94112ed656c35ac5bf91a5a84bf955b95f9010a8590af8282

See more details on using hashes here.

File details

Details for the file tooly_dev-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: tooly_dev-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for tooly_dev-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e8ea3b1829596725de7e6a7c55245401ad2f04d820447f819ea65612d807a399
MD5 036e19a173d49f76c1afd9ea59dc1387
BLAKE2b-256 19920bf53a310a32451e5bf52d324adc0dba11158656fc1ea0dd2b5b6c4d9616

See more details on using hashes here.

Supported by

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