Skip to main content

oakley

A small collection of lightweight, opinionated utilities for printing "fancy" console output in Python: colored strings, pretty messages, simple progress bars, task context managers, and tiny system/status helpers.

This package is designed for developer convenience when running short scripts or CLI-style tasks. It provides a few cooperating classes that make it easy to print colored, indented, and optionally muted output, plus a couple of helpers for memory and time display.

Features

  • Colored strings with convenient format specifiers (cstr) — easy ANSI coloring and simple format shortcuts.
  • Message class for categorized, pretty messages (info, warning, error, success).
  • Task context manager to wrap and time operations, with neat completion/abort output.
  • ProgressBar iterator wrapper with estimated remaining time and non-intrusive whisper messages.
  • MutableClass base with global mute/tab behavior so multiple components coordinate console output.
  • Small status helpers: MemoryView and DateTime for quick runtime info.

Installation

You can downlaod the package with this command:

pip install oakley

Alternatively, you can download the most up-to-date version from my github repository:

pip install git+https://github.com/ProfesseurShadoko/oakley.git

Quick examples

Colored strings

from oakley import cstr
print(cstr('hello world').green().bold())
print(f"Progress: {cstr('ok'):g}")  # short color spec
print(f"{cstr('Done'):gb}")  # in green and bold

Pretty messages

from oakley import Message
Message("Build succeeded", "#")       # green success prefix
Message("Something might be wrong", "?")

Tasks and timing

from oakley import Task
import time

with Task("Compute something heavy"):
	time.sleep(1.2)

Progress bar

from oakley import ProgressBar
import time

for i in ProgressBar(range(50), size=50):
	time.sleep(0.02)
	if i == 25:
		ProgressBar.whisper("Halfway there!")

Status helpers

from oakley import MemoryView, DateTime()
MemoryView()              # prints a short memory usage line (requires psutil)
DateTime()

Mute and indentation

from oakley import MutableClass, Message

MutableClass.mute()       # globally mute printing
MutableClass.unmute()

with Message.mute():
	Message.print("This won't be printed")
Message.print("This will be printed again!")

with Message("The following messages will be indented"):   # increase indentation for nested prints
	Message.print("This will be indented")
    MemoryView() # also indented
Message("This won't be indented")

Examples

Take a look at this notebook for the most detailed and up to date examples.

Alternatively, run the command:

python -m oakley.<filename_without_dot_py>

to see examples for each object.

Finally, see this script for an example on how to use the @cli decorator on a function.

Development notes

  • The package is intentionally tiny and uses ANSI escape sequences for coloring; compatibility is best on UNIX-like terminals.
  • MemoryView depends on psutil — the package runs fine even when psutil is not available, but the MemoryView object cannot be used.
  • There are simple demo blocks in each module under if __name__ == '__main__' for manual testing.

Metadata

Release files for oakley 3.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oakley 3.3.4
File Size Uploaded Provenance
oakley-3.3.4.tar.gz 34.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for oakley 3.3.4
File Interpreter ABI Platform
oakley-3.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 71.9 kB

Release files / oakley-3.3.4.tar.gz

Download URL oakley-3.3.4.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ec3aacc1d580053f0a85f2244eaa0aabb6c87dea565ab8886197ad17d266026c
BLAKE2b-256 checksum
How to use checksums
c90b9f1cf5d60c6bf6555e18df99b662a647e03ef2e4ef7720ea33257b5dfe65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / oakley-3.3.4-py3-none-any.whl

Download URL oakley-3.3.4-py3-none-any.whl
Size 37.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89b129f0d5ad9c3aa75fc233a713c534616482fffe253ffca2115c667f6748b9
BLAKE2b-256 checksum
How to use checksums
1a8ad4c9a51076c0c5d8c07c252e50db6ca3d2d31cdee776567b525f8ccc2de5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for oakley 3.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.3.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page