Metadata-Version: 2.4
Name: mlops-monitor
Version: 0.1.0
Summary: Add your description here
Author-email: geetheswar-v <geetheswar.edu@gmail.com>
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: aiohttp>=3.13.5
Requires-Dist: aiosqlite>=0.22.1
Requires-Dist: fastapi>=0.135.2
Requires-Dist: httpx>=0.28.1
Requires-Dist: jinja2>=3.1.6
Requires-Dist: sqlalchemy>=2.0.49
Requires-Dist: uvicorn[standard]>=0.42.0

# mlops-monitor

Lightweight MLOps monitoring toolkit with a web UI, metric logging, drift detection, and run management (inspired by Weights & Biases).

## Features

- Log metrics, hyperparameters, and feature distributions from any Python ML script
- Automatic run metadata capture (host, platform, Python version, command, etc.)
- Console output capture (stdout/stderr) into run logs
- Data drift and concept drift detection (C‑backed helpers)
- Web UI: Projects → Runs → Metrics graphs (live and historical)
- SQLite storage, FastAPI + HTMX + Alpine.js + Chart.js frontend

## Installation

### As a dependency in your project (pip / uv)

```bash
# using uv
uv add mlops-monitor

# using pip
pip install mlops-monitor
```

### Editable install for local development / demo

From the repo root:

```bash
uv build
# then in your project:
uv add --path ../path/to/mlops-monitor --editable
```

Or inside the `demo/` folder (already configured):

```bash
cd demo
uv sync  # uses the editable path defined in pyproject.toml
```

## Quick start

### 0. Configure project (first time)

```bash
uv run monitor edit-config
```

This will ask:
- Whether to isolate the project (use local DB instead of global)
- Whether to enable email alerts
- Your email address(es) for alerts

### 1. In your training script

```python
from mlops_monitor import init, log_metrics, capture_output, end

async def main():
    monitor = init("my-project", "run-1")
    capture_output()          # capture prints into run logs
    run_id = await monitor.start()

    for epoch in range(20):
        # train your model ...
        await log_metrics({
            "accuracy": acc,
            "loss": loss,
        }, step=epoch)
        # ...

    await end()                # marks run as completed

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())
```

### 2. Launch the UI

```bash
uv run monitor ui
# opens at http://localhost:8000
```

### 3. Open the UI

- `/` – Projects list
- `/project/{id}` – Project overview, run list, and multi‑run metric charts
- `/project/{id}/runs/{run_id}` – Run details, summary, per‑run charts, and captured logs

## Development

```bash
git clone ...
cd Cproject
uv sync
uv build                # builds sdist + wheel
uv run monitor ui        # start local UI
```

The `demo/` folder contains a full example using scikit‑learn.
