Skip to main content

Terminal utilities for CLI, TUI, IO and general use

Project description

termz

Terminal utilities for CLI, TUI, IO and general use.

pip install termz

Status: early alpha — API is unstable.


Modules

termz.cli — Styled output & prompts

from termz.cli import success, error, warn, info, confirm

success("Build complete")
warn("Deprecated flag used")
error("Something went wrong")
info("Listening on port 8080")

if confirm("Continue?", default=True):
    ...

termz.tui — Spinner

from termz.tui import Spinner
import time

with Spinner("Loading data..."):
    time.sleep(2)

termz.io — stdin & file helpers

from termz.io import is_piped, read_stdin, read_file, write_file

if is_piped():
    data = read_stdin()

content = read_file("config.toml")
write_file("output/result.txt", "done")

termz.utils — General utilities

from termz.utils import terminal_size, truncate, slugify, platform_name

cols, lines = terminal_size()
print(truncate("A very long string", width=12))  # "A very lo..."
print(slugify("Hello, World!"))                  # "hello-world"
print(platform_name())                           # "macos"

Requirements

  • Python 3.10+
  • No external dependencies

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

termz-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

termz-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file termz-0.1.0.tar.gz.

File metadata

  • Download URL: termz-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for termz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 643f831a150a7793db3f2154be9b50fccc326c97f045dd6997b19ef5cf636989
MD5 66fa543035cddd5e186dc4cc46868c86
BLAKE2b-256 143c696a04eac9ef8bacd45fb6edb84cd366274528f8944d094c72fb302a4f2e

See more details on using hashes here.

File details

Details for the file termz-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: termz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for termz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1f1721a023fcb0723f0d99dc8ef3f7f6b1b29e4f4a480ffdda144808bd3c3dc
MD5 bdabc3d3b42cde91133a98bed043d389
BLAKE2b-256 6261416bf9a5a44da4af941edeca3daf183d652df8510c12ab637aa5b168a8f1

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