Metadata-Version: 2.4
Name: pico-actuator
Version: 0.1.0
Summary: Spring Boot-style actuator for the Pico ecosystem: /health, /info, /metrics over pico-fastapi.
Author-email: David Perez Cabrera <dperezcabrera@gmail.com>
License: MIT License
        
        Copyright (c) 2026 David Perez Cabrera
        
        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/dperezcabrera/pico-actuator
Project-URL: Documentation, https://dperezcabrera.github.io/pico-actuator/
Project-URL: Repository, https://github.com/dperezcabrera/pico-actuator
Project-URL: Changelog, https://github.com/dperezcabrera/pico-actuator/blob/main/CHANGELOG.md
Project-URL: Issue Tracker, https://github.com/dperezcabrera/pico-actuator/issues
Keywords: ioc,di,actuator,health,fastapi,spring boot,observability
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pico-ioc>=2.2.0
Requires-Dist: pico-fastapi>=0.2.0
Provides-Extra: metrics
Requires-Dist: prometheus-client; extra == "metrics"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-cov>=5; extra == "dev"
Requires-Dist: httpx; extra == "dev"
Requires-Dist: pico-boot; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Dynamic: license-file

# 📦 pico-actuator

[![PyPI](https://img.shields.io/pypi/v/pico-actuator.svg)](https://pypi.org/project/pico-actuator/)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/dperezcabrera/pico-actuator)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
![CI (tox matrix)](https://github.com/dperezcabrera/pico-actuator/actions/workflows/ci.yml/badge.svg)
[![codecov](https://codecov.io/gh/dperezcabrera/pico-actuator/branch/main/graph/badge.svg)](https://codecov.io/gh/dperezcabrera/pico-actuator)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-actuator&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-actuator)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-actuator&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-actuator)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=dperezcabrera_pico-actuator&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=dperezcabrera_pico-actuator)
[![Docs](https://img.shields.io/badge/Docs-pico--actuator-blue?style=flat&logo=readthedocs&logoColor=white)](https://dperezcabrera.github.io/pico-actuator/)
[![Interactive Lab](https://img.shields.io/badge/Learn-online-green?style=flat&logo=python&logoColor=white)](https://dperezcabrera.github.io/pico-learn/)

Spring Boot-style **actuator** endpoints for the [Pico](https://github.com/dperezcabrera/pico-ioc) ecosystem,
built on top of [pico-fastapi](https://github.com/dperezcabrera/pico-fastapi).

Auto-discovered by [pico-boot](https://github.com/dperezcabrera/pico-boot) — install it and the endpoints appear:

| Endpoint | Purpose |
|---|---|
| `GET /actuator/health` | Overall status + per-component detail (`200`/`503`) |
| `GET /actuator/health/live` | Liveness — process is responding, touches no deps |
| `GET /actuator/health/ready` | Readiness — aggregate of all health indicators |
| `GET /actuator/info` | Static config + dynamic contributors |
| `GET /actuator/metrics` | Prometheus default registry (needs the `metrics` extra) |

## Install

```bash
pip install pico-actuator
# optional Prometheus /metrics:  pip install pico-actuator[metrics]
```

## Use

Contribute health by implementing `HealthIndicator` and marking it `@component`.
No registration, no wiring — pico-ioc collects them via `List[HealthIndicator]`:

```python
from pico_ioc import component
from pico_actuator import HealthIndicator

@component
class DbHealth:  # satisfies HealthIndicator
    name = "db"
    def __init__(self, engine: Engine):
        self.engine = engine
    def check(self):
        self.engine.connect().close()
        return {"status": "UP"}
```

`check()` may be sync or async; return a dict (`{"status": "UP", ...}`) or a
truthy value. Indicators run concurrently, each under a configurable timeout
(`actuator.check_timeout_seconds`, default 5s). A raising or hanging indicator
is reported `DOWN` in isolation — it never takes the endpoint down.

Add `/info` data the same way with `InfoContributor`, or statically via config:

```yaml
# application.yaml
actuator:
  enabled: true
  show_components: true
  info:
    app: my-service
    build: "2026.06"
```

## Documentation

Full docs at **[dperezcabrera.github.io/pico-actuator](https://dperezcabrera.github.io/pico-actuator/)** — getting started, user guide, how-to guides, API reference.

## AI Coding Skills

[Claude Code](https://code.claude.com) and [OpenAI Codex](https://openai.com/index/introducing-codex/) skills for AI-assisted development:

```bash
curl -sL https://raw.githubusercontent.com/dperezcabrera/pico-skills/main/install.sh | bash -s -- actuator
```

## Why

`pico-ioc` already exposes `@health`/`@cleanup` lifecycle primitives but nothing
*serves* them. This package is the thin layer that turns them into operable
HTTP endpoints — the one observability piece you can't improvise in ten lines.

## License

MIT
