Metadata-Version: 2.4
Name: azucout
Version: 0.0.1
Summary: Zero-dependency structured console output, CJK-aligned tables, reminders, and timers for Python CLI tools.
Author: Kazekawa-azusa
License: # MIT License
        
        Copyright (c) 2026 Kazekawa Azusa / Azustock Co., Phy.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/AZUSTOCK/azucout
Project-URL: Repository, https://github.com/AZUSTOCK/azucout
Keywords: cli,console,logging,terminal,ansi,table,timer,cjk
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Terminals
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.md
Dynamic: license-file

# 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
```bash
pip install azucout
```

### Directly from GitHub
```bash
pip install "azucout @ git+https://github.com/AZUSTOCK/azucout.git@V0.0.1"
```

Or pin it in `requirements.txt`:
```text
azucout @ git+https://github.com/AZUSTOCK/azucout.git@V0.0.1
```

### Editable local install (multi-repo development)
```bash
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:

```python
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
```python
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
```python
# 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
```python
# 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:

```python
from azucout import Cout, cout, styled
```

## Development & Testing

```bash
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](https://github.com/AZUSTOCK/azu-workflows) pipeline in [.github/workflows/release.yml](https://www.google.com/search?q=.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](https://www.google.com/search?q=./LICENSE.md).
