Skip to main content

azucout

A zero-dependency structured console output library for Python CLI scripts, build pipelines, and CI/CD workflows. Supports Emoji, Text, Terminal, and None output styles, CJK-aligned tables, nested tree indentation, reminder collectors, interactive menus, and built-in timers.

Features

  • Zero external dependencies: Pure Python standard library (Python >= 3.9), with automatic Windows ANSI support and NO_COLOR awareness.
  • Four built-in output modes:
    • emoji — Visual icons for local development (default)
    • text — Plain bracketed labels ([OK], [WARN], [ERR])
    • terminal — Minimalist ASCII terminal style (>_, [+], [!], [x], ::, |-) with zero emoji width drift
    • none — Clean output with no icon prefixes
  • Built-in timers: Both manual (start_timer / elapsed / end_timer) and context-manager (with cout.timer(...)) APIs.
  • CJK-aligned tables: Automatically strips ANSI escape codes and computes East Asian full-width character alignment.
  • Safe & real-time: Sanitizes control characters and flushes stdout immediately (flush=True) for clean subprocess and CI streaming.

Installation

From PyPI

pip install azucout

Directly from GitHub

pip install "azucout @ git+https://github.com/AZUSTOCK/azucout.git@V0.0.1"

Or pin it in requirements.txt:

azucout @ git+https://github.com/AZUSTOCK/azucout.git@V0.0.1

Editable local install (multi-repo development)

pip install -e ../azucout

Usage Examples

1. Basic Logging & Output Modes

Switch between emoji, text, terminal, and none via Cout(mode=...), cout.set_icon_mode(...), or the AZUCOUT_MODE environment variable:

from azucout import Cout, cout, styled

# Global singleton (defaults to "emoji", or AZUCOUT_MODE env var)
cout.info("Loading configuration...")
cout.success("All checks passed")
cout.warn("Cache miss, rebuilding...")
cout.error("Failed to read file")
cout.skip("Unchanged asset skipped")

# Pure ASCII terminal mode (ideal for CI, CMD, and PowerShell)
term = Cout(mode="terminal")
term.stage("BUILD", "Compile frontend assets")
term.info("Reading src/js/*.js")
term.success("Bundled main.js")

2. Indentation, Tree Actions & Size Deltas

with term.indent():
    term.action("Bundle", "Merged 9 JS modules", context="Frontend", icon_key="stage", tree=True)
    term.size_action("Minify", "main.min.js", 470.2, 312.8, context="Assets")
    # Or compare two files directly on disk:
    # term.file_size_action("WebP", "raw.png", "out.webp", context="Media")

3. Timers

# Context manager (recommended)
with term.timer("Build Pipeline", "Full site generation"):
    # ... run build steps ...
    pass

# Manual multi-stage timer
term.start_timer("total")
# ... run multiple stages ...
elapsed_sec = term.end_timer("total", title="Total Elapsed", message="All stages done")

4. Aligned Tables, Reminders & Interactive Menus

# CJK-aware, ANSI-safe aligned table
term.table(
    title="Build Summary",
    headers=["Module", "Status", "Time"],
    rows=[
        ["Frontend", styled("OK", "green"), "0.02s"],
        ["Media WebP", styled("SKIP", "gray"), "0.00s"],
    ],
    aligns=["left", "center", "right"],
)

# Collect reminders during a run and flush once at the end
term.collect_reminder("EXPIRED", "Tag 'NEW:2026-08-01' expired", filepath="projects/demo/detail.json")
term.flush_reminders("Maintenance Reminders")

# Interactive CLI prompt with default value
choice = term.menu("Select build mode:", [("1", "Fast skip"), ("2", "Force rebuild")], default="1")

Drop-in Re-export for Existing Projects

If an existing project imports from a local helper (e.g. from tools.common.cout import cout), replace that file with a one-line re-export so existing imports require zero changes:

from azucout import Cout, cout, styled

Development & Testing

python -m unittest discover -s tests -v
python -m azucout.cout
python scripts/sync_version.py --check

Releases & PyPI Publishing

This repository uses the shared AZUSTOCK/azu-workflows pipeline in .github/workflows/release.yml:

  1. Add a new version entry under logs/ (e.g., logs/V0.0/V0.0.1/detail.json + update.md), then run python scripts/sync_version.py so azucout/__init__.py matches.
  2. Push to main: release.yml detects the new version in logs/, creates the V* GitHub Release, tests and builds the wheel/sdist (excluding logs/), publishes to PyPI via OIDC Trusted Publishing, and sends a Discord release notification.
  3. Secrets & Environment:
    • Configure the repository Actions secret DISCORD_WEBHOOK for release announcements.
    • Register AZUSTOCK/azucout, workflow release.yml, and environment pypi as a PyPI Trusted Publisher (or Pending Publisher before the first upload).

License

This project is licensed under the MIT License.

Metadata

Release files for azucout 0.0.1

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

Source distribution (sdist)

Source distribution for azucout 0.0.1
File Size Uploaded Provenance Actions
azucout-0.0.1.tar.gz 14.4 kB With provenance Details for azucout-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 26.6 kB

Release files / azucout-0.0.1.tar.gz

Download URL azucout-0.0.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
82f3a8d073aa4b551c1cb968a510085f610504305c83a3aee48f84baf65463f8
BLAKE2b-256 checksum
How to use checksums
d8a895f78edb86379a2f5d83bfb4a2890e84d88f5b1cc4e4884659337fbe2045
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / azucout-0.0.1-py3-none-any.whl

Download URL azucout-0.0.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a02f73861b8cebf9b751dfeb900313cf8cc9da5c14313e96f48258a5e66b107b
BLAKE2b-256 checksum
How to use checksums
265c9012ca1fb5dff84690d0ba84fc0db2ea14f664fccabda01f833ac14093e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for azucout 0.0.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for azucout-0.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

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

0.0.1 This release

2 release files Full 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