Apathetic Python Utils βš™οΈ

Grab bag of helpers for Apathetic projects.
When stdlib is almost enough.

Apathetic Python Utils provides a lightweight, dependency-free collection of utility functions designed for CLI tools. It includes helpers for file loading, path manipulation, system detection, text processing, type checking, pattern matching, and more.

Features

Quick Example

from apathetic_utils import load_jsonc, load_toml, is_ci, detect_runtime_mode, capture_output
from pathlib import Path
import sys

# Load configuration files
config = load_jsonc(Path("config.jsonc"))
pyproject = load_toml(Path("pyproject.toml"))

# Detect environment
if is_ci():
    print("Running in CI")

# Detect runtime mode (package, stitched, zipapp, frozen)
mode = detect_runtime_mode("my_package")
print(f"Running in {mode} mode")

# Capture output from CLI commands
with capture_output() as cap:
    # Run some command that prints to stdout/stderr
    print("Hello, world!")
    print("Error message", file=sys.stderr)

print(f"Captured: {cap.merged.getvalue()}")

Requirements

No other dependencies required β€” this library uses only Python’s standard library.

Installation

Install via poetry or pip:

# Using poetry
poetry add apathetic-utils

# Using pip
pip install apathetic-utils

For alternative installation methods, see the Installation Guide.

Documentation

License

MIT-a-NOAI License

You’re free to use, copy, and modify the library under the standard MIT terms.
The additional rider simply requests that this project not be used to train or fine-tune AI/ML systems until the author deems fair compensation frameworks exist.
Normal use, packaging, and redistribution for human developers are unaffected.

Resources