nice and simple command line output
Project description
opsis
Nice and simple command-line output for Python. Fka comms
Note: This package is experimental — the API may change between releases.
What is this?
opsis gives you a clean, consistent way to print structured output from CLI applications. It handles the fiddly bits — column alignment, truncation, spinners, timing — so you can focus on what your tool actually does.
It's particularly useful for scripts and tools that perform a sequence of discrete tasks (parsing files, calling APIs, running checks, etc.) where you want to show progress without cluttering the terminal.
Install
pip install opsis
Quick start
from opsis import Comms
comms = Comms(prefix="myapp")
comms.announce("Starting up")
comms.talk("Processing input files...")
comms.warn("Something looks off!")
This produces neatly aligned, prefixed output like:
[myapp] Starting up
[myapp] -> Processing input files...
[myapp] ** Something looks off!
Features
Messages
comms.talk("Regular message") # prefixed, indented with ->
comms.announce("Important heading") # bold, followed by a blank line
comms.warn("Something went wrong") # bold red, indented with **
Multi-line messages
Print structured, multi-line output with an optional boldened title:
comms.state("Line one\nLine two\nLine three", title="Results")
comms.state(["Also works", "with lists"])
Reporter
For multi-step operations, use a Reporter. It manages tasks, steps, timing, and animated spinners for you:
reporter = comms.reporter()
reporter.start("building project") # begins a timed task
reporter.step("compiling sources") # shows a spinner while waiting
# ... do work ...
reporter.step("linking binaries") # finishes previous step, starts next
# ... do work ...
reporter.done() # prints completion with elapsed time
Each step is automatically timed. While a step is running, a spinner animates in-place. When the next step starts (or done() is called), the previous step's duration is printed:
[myapp] start building project ...
[myapp] .. compiling sources ✓ (1.203s)
[myapp] .. linking binaries ✓ (0.042s)
[myapp] done building project! ✓ (1.245s)
For fast, repetitive operations, use a ticker instead of a spinner:
reporter.step("processing files", spin=False)
for i, path in enumerate(files):
process(path)
reporter.tick(f"file {i}") # updates in-place, throttled
You can still use comms.talk() and comms.warn() during a reporter session — they print cleanly without disrupting the spinner.
Custom prefix
Every Comms instance takes a prefix that appears in brackets on each line. Use this to identify your tool:
comms = Comms(prefix="deploy")
# [deploy] -> uploading artifacts...
TTY detection
Spinners and tickers are automatically disabled when stdout is not a TTY (e.g. when piping to a file or running in CI). Your output stays clean and parseable without any extra configuration.
Dependencies
Just click (for styled terminal output).
License
MIT
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 opsis-0.1.1.tar.gz.
File metadata
- Download URL: opsis-0.1.1.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c8f23955f5c03e704e0c53fa01727127113b170b5088d221006275f3c6970f2
|
|
| MD5 |
fd9d75902280993ab8178eb00ddc6a8b
|
|
| BLAKE2b-256 |
c09695864f71e29e3559d16326b2cdd2be058cba86a6490c15c805943629b006
|
Provenance
The following attestation bundles were made for opsis-0.1.1.tar.gz:
Publisher:
release.yml on sirmarcel/opsis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opsis-0.1.1.tar.gz -
Subject digest:
4c8f23955f5c03e704e0c53fa01727127113b170b5088d221006275f3c6970f2 - Sigstore transparency entry: 1066597113
- Sigstore integration time:
-
Permalink:
sirmarcel/opsis@5723802b35eb1efd35b38cff737069f844afd6aa -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sirmarcel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5723802b35eb1efd35b38cff737069f844afd6aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file opsis-0.1.1-py3-none-any.whl.
File metadata
- Download URL: opsis-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c670da7b116526d605030cdd835818ddb32f90895bc7a2ced5b3be65a1b76fbf
|
|
| MD5 |
f2f74dce660148f47279fa81ff501590
|
|
| BLAKE2b-256 |
41cc95cb2cb9a56dae85751cd637194d826878dcbb821c06e90c5580dfbe1532
|
Provenance
The following attestation bundles were made for opsis-0.1.1-py3-none-any.whl:
Publisher:
release.yml on sirmarcel/opsis
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opsis-0.1.1-py3-none-any.whl -
Subject digest:
c670da7b116526d605030cdd835818ddb32f90895bc7a2ced5b3be65a1b76fbf - Sigstore transparency entry: 1066597117
- Sigstore integration time:
-
Permalink:
sirmarcel/opsis@5723802b35eb1efd35b38cff737069f844afd6aa -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/sirmarcel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5723802b35eb1efd35b38cff737069f844afd6aa -
Trigger Event:
push
-
Statement type: