From 4f01748e6924bb9921f14cb8f5a71a5301b4740c Mon Sep 17 00:00:00 2001 From: PakitoSec Date: Mon, 24 Aug 2026 08:46:35 +0200 Subject: [PATCH] Agent Host changes for agents/release-logurich-100-readiness --- .github/workflows/ci.yml | 2 +- .pre-commit-config.yaml | 4 ++-- AGENTS.md | 16 ++++++++-------- README.md | 8 +++----- pyproject.toml | 4 +++- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7206f6e..77d1964 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: contents: read strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v6 - name: Set up uv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfe56ff..a7aac13 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.0 + rev: v0.16.4 hooks: - - id: ruff + - id: ruff-check - id: ruff-format diff --git a/AGENTS.md b/AGENTS.md index 9181228..25e1d91 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,26 +1,26 @@ # Repository Guidelines ## Project Structure & Module Organization -The reusable library code lives in `src/logurich/`, with `core.py` handling stdlib logging integration and queue setup, `console.py` encapsulating Rich rendering helpers, and `handler.py` providing custom Rich and console handlers. Shared state lives in `struct.py`. Tests reside in `tests/` and mirror module names (`test_core.py`, `test_rich.py`, `test_mp.py`). Runnable walkthroughs live in `examples/` for quick validation of logging scenarios. Packaging metadata is in `pyproject.toml` alongside the dependency lockfile `uv.lock`. +The reusable library code lives in `src/logurich/`, with `core.py` handling stdlib logging integration, the `LogurichLogger` adapter and queue setup, `console.py` encapsulating Rich console helpers, `handler.py` providing custom Rich and console handlers, `context.py` holding bound and ambient context, `serialize.py` converting Rich renderables to structured JSON, `premarkup.py` implementing the premarkup tags, `user_input.py` offering prompt helpers, and `opt_click.py` exposing the optional Click decorator. Shared state lives in `struct.py`. Tests reside in `tests/` and mirror module names (`test_core.py`, `test_rich.py`, `test_mp.py`). Runnable walkthroughs live in `examples/` for quick validation of logging scenarios. Packaging metadata is in `pyproject.toml` alongside the dependency lockfile `uv.lock`. ## Environment Setup Use uv to keep the development environment reproducible. From the repo root run: -- `uv venv` to create `.venv` -- `source .venv/bin/activate` -- `uv pip install -e ".[dev]"` to install runtime and pytest extras -Re-run the last command whenever dependencies change. +- `uv sync --all-extras --all-groups` to create `.venv` and install runtime, optional and dev dependencies +- `source .venv/bin/activate` if you prefer an activated shell over `uv run` +Re-run the sync command whenever dependencies change. `dev` is a dependency group, not an extra, so `uv pip install -e ".[dev]"` does not work. ## Build, Test, and Development Commands - `uv run pytest` executes the entire test suite with the active virtualenv. +- `uv run ruff check .` and `uv run ruff format --check .` mirror the lint gate. - `uv run python examples/base.py` demonstrates the default logger output; adapt the script when validating new features. - `uv run python examples/mp_example.py` stress-tests multi-process logging behaviour. -Publishing is orchestrated through the GitHub Actions workflows (`.github/workflows/`); manual builds use `python -m build` if you need a local wheel. +Publishing is orchestrated through the GitHub Actions workflows (`.github/workflows/`); pushing a `v*.*.*` tag builds and publishes to PyPI. Use `uv build` if you need a local wheel. ## Coding Style & Naming Conventions -Follow PEP 8 with four-space indentation and `snake_case` for functions, module-level helpers, and test names. Classes such as `Formatter` stay in `PascalCase`. Prefer explicit imports from `logurich`'s public API via `__init__.py`, and include type hints for new parameters and return values. Use `ctx(...)` inside `extra={"context": ...}` payloads for styled contextual values. Keep log message strings formatted via stdlib logging style (e.g., `logger.info("Value %s", value)`). +Follow PEP 8 with four-space indentation and `snake_case` for functions, module-level helpers, and test names. Classes such as `Formatter` stay in `PascalCase`. Prefer explicit imports from `logurich`'s public API via `__init__.py`, and include type hints for new parameters and return values. Pass context as plain call keywords (`logger.info("Login", user=ctx("alice"))`) and use `ctx(...)` for styled values; the 0.9 `extra={"context": ...}` and `extra={"renderables": ...}` payloads were removed and now raise. Keep log message strings formatted via stdlib logging style (e.g., `logger.info("Value %s", value)`). ## Testing Guidelines Write tests with pytest and place them under `tests/`, naming files `test_.py` and functions `test_`. Reuse shared fixtures from `tests/conftest.py`. Ensure new log formatting paths have representative assertions, and extend the example scripts when manual verification is useful. Run `uv run pytest` before opening a PR; aim to cover both the standard and rich rendering paths. ## Commit & Pull Request Guidelines -Commits follow Conventional Commit syntax (`type(scope): summary`) as seen in `git log`. Keep changes scoped and mention relevant modules in the scope. Pull requests must include a short summary, linked issues if applicable, and notes on testing (`uv run pytest`). Attach before/after screenshots or logs when changing console output. CI runs the test matrix across Python 3.9–3.13; wait for green builds before merging. +Commits follow Conventional Commit syntax (`type(scope): summary`) as seen in `git log`. Keep changes scoped and mention relevant modules in the scope. Pull requests must include a short summary, linked issues if applicable, and notes on testing (`uv run pytest`). Attach before/after screenshots or logs when changing console output. CI runs the test matrix across Python 3.9–3.14; wait for green builds before merging. diff --git a/README.md b/README.md index 4ecd489..ceb8a1b 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,7 @@ logger = get_logger(__name__) logger.info("Processed %s items", 12, batch="b-42") -request_logger = logger.bind( - request_id=logger.ctx("req-42", style="cyan") -) +request_logger = logger.bind(request_id=logger.ctx("req-42", style="cyan")) request_logger.info("Request completed", duration_ms=17) with logger.contextualize(user_id="alice"): @@ -95,8 +93,8 @@ Console and file formats are independent: ```python init_logger( "INFO", - console="rich", # auto | rich | plain | json - file="json", # text | json + console="rich", # auto | rich | plain | json + file="json", # text | json log_filename="app.log", ) ``` diff --git a/pyproject.toml b/pyproject.toml index 127993b..2e8c3d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ "rich>=13.7.0" ] classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Logging", @@ -32,6 +32,8 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Typing :: Typed", "Operating System :: OS Independent", ]