Metadata-Version: 2.4
Name: sitaka-api
Version: 0.1.0
Summary: End-to-end machine learning API toolkit with AutoML, MLflow, EDA, and deployment generators.
Author-email: Akhil Vydyula <akhil.vdb@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/akhilvydyula/sitaka-api
Project-URL: Documentation, https://github.com/akhilvydyula/sitaka-api#readme
Project-URL: Source, https://github.com/akhilvydyula/sitaka-api
Project-URL: Issues, https://github.com/akhilvydyula/sitaka-api/issues
Keywords: automl,mlops,fastapi,mlflow,machine-learning,deployment
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi>=0.110
Requires-Dist: httpx>=0.27
Requires-Dist: joblib>=1.3
Requires-Dist: mlflow>=2.12
Requires-Dist: numpy>=1.24
Requires-Dist: optuna>=3.6
Requires-Dist: pandas>=2.0
Requires-Dist: pydantic>=2.6
Requires-Dist: pyyaml>=6.0
Requires-Dist: scikit-learn>=1.3
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: typer>=0.12
Requires-Dist: uvicorn>=0.29
Provides-Extra: boosting
Requires-Dist: catboost>=1.2; extra == "boosting"
Requires-Dist: lightgbm>=4.0; extra == "boosting"
Requires-Dist: xgboost>=2.0; extra == "boosting"
Provides-Extra: deploy
Requires-Dist: django>=5.0; extra == "deploy"
Requires-Dist: flask>=3.0; extra == "deploy"
Requires-Dist: streamlit>=1.33; extra == "deploy"
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Provides-Extra: parquet
Requires-Dist: pyarrow>=15.0; extra == "parquet"
Dynamic: license-file

# SITAKA API

SITAKA API is an enterprise-ready machine learning product platform for moving from data to a deployable model service with one consistent developer experience.

It combines a Python package, CLI, FastAPI product API, AutoML workflow, MLflow tracking, model registry records, and deployment generators for FastAPI, Flask, Streamlit, and Django.

## What SITAKA Solves

Most ML projects fail between experimentation and deployment. SITAKA gives teams a repeatable path:

```mermaid
flowchart LR
    data["Data"] --> profile["Profile and Validate"]
    profile --> train["AutoML Training"]
    train --> registry["Model Registry"]
    registry --> predict["Prediction API"]
    registry --> deploy["Deployment Generator"]
    train --> mlflow["MLflow Tracking"]
```

Use SITAKA when you want:

- A single workflow from dataset to deployable service.
- Interactive project setup through `sitaka init`.
- AutoML search over sklearn-style pipelines with Optuna.
- EDA reports and durable artifacts.
- MLflow experiment tracking.
- A portable model bundle with `model.joblib` and `metadata.json`.
- A first-party FastAPI product API for projects, jobs, models, prediction, and deployments.
- Generated model services with health, readiness, metadata, schema, prediction, optional API key auth, Docker, and compose files.
- Examples for tabular, NLP, time-series baseline, and image-manifest workflows.

## Current Capabilities

| Area | Status |
| --- | --- |
| Python package and CLI | Available |
| Interactive config generation | Available |
| CSV, Parquet, JSON, SQL, folder ingestion | Available |
| Tabular classification/regression | End-to-end |
| NLP classification/regression | Baseline sklearn text workflow |
| Time-series forecasting | Baseline regression-style workflow |
| Image classification | Manifest-based scaffold |
| MLflow tracking | Available |
| FastAPI product API | Available |
| SQLite project/job/model/deployment/audit store | Available |
| API key auth and RBAC-ready roles | Available |
| Generated FastAPI, Flask, Streamlit, Django apps | Available |
| Deep learning, streaming, feature store, DVC, drift automation | Roadmap |

## Installation

Use Python 3.10 or newer.

After SITAKA is published to PyPI, users install it like any normal Python package:

```powershell
pip install sitaka-api
sitaka server
```

Then open:

```text
http://127.0.0.1:8000
http://127.0.0.1:8000/docs
```

If the repo must stay private while PyPI is pending, publish to GitLab Package Registry and install with:

```powershell
pip install sitaka-api --index-url "https://<deploy-token-user>:<deploy-token>@gitlab.com/api/v4/projects/<project-id>/packages/pypi/simple" --extra-index-url "https://pypi.org/simple"
sitaka server
```

Then open `http://127.0.0.1:8000/docs`. See [`docs/gitlab-package-registry.md`](docs/gitlab-package-registry.md).

For local development from this repository:

```powershell
python -m venv .venv
.venv\Scripts\activate
pip install -e ".[dev,deploy,parquet]"
```

Optional boosted model backends:

```powershell
pip install -e ".[boosting]"
```

If the `sitaka` command is unavailable:

```powershell
python -m sitaka_api --help
```

## Five-Minute Demo

Run the included Iris classification example:

```powershell
sitaka run --config examples/tabular_classification/sitaka.yaml
```

SITAKA will:

1. Load `examples/tabular_classification/iris.csv`.
2. Generate an EDA report.
3. Train candidate models.
4. Save the best model bundle.
5. Log MLflow artifacts when enabled.
6. Generate a deployable FastAPI service.

Expected outputs:

```text
sitaka_artifacts/
  reports/eda_report.md
  metrics.json
  models/best_model/model.joblib
  models/best_model/metadata.json

sitaka_deployment/
  model_bundle/
  serve.py
  requirements.txt
  Dockerfile
  docker-compose.yml
  .env.example
```

Run a local prediction:

```powershell
sitaka predict `
  --bundle sitaka_artifacts/models/best_model `
  --record sepal_length=5.1 `
  --record sepal_width=3.5 `
  --record petal_length=1.4 `
  --record petal_width=0.2
```

## Create Your Own Project

Create an interactive config:

```powershell
sitaka init
```

For automation:

```powershell
sitaka init --defaults
```

Minimal `sitaka.yaml`:

```yaml
project_name: churn-demo
task: tabular_classification
artifacts_dir: sitaka_artifacts
data:
  source: data/churn.csv
  format: csv
  target: churn
automl:
  enabled_models:
    - random_forest
    - extra_trees
    - gradient_boosting
    - linear
  n_trials: 25
mlflow:
  enabled: true
  experiment_name: sitaka-api
  tracking_uri: file:./mlruns
deployment:
  framework: fastapi
  output_dir: sitaka_deployment
```

Run stage by stage:

```powershell
sitaka profile --config sitaka.yaml
sitaka train --config sitaka.yaml
sitaka evaluate --config sitaka.yaml
sitaka deploy --config sitaka.yaml --framework fastapi
```

Or run everything:

```powershell
sitaka run --config sitaka.yaml
```

## Product API Mode

Start the enterprise product API:

```powershell
sitaka server --host 127.0.0.1 --port 8000
```

Open either page:

```text
http://127.0.0.1:8000
http://127.0.0.1:8000/docs
```

The root page returns a readable JSON welcome message with links to the API docs and health checks. If `sitaka server` is not found, reinstall the local editable package:

```powershell
.venv\Scripts\activate
pip install -e ".[dev,deploy,parquet]"
python -m sitaka_api server
```

Core endpoints:

- `GET /v1/health`
- `GET /v1/ready`
- `POST /v1/projects`
- `GET /v1/projects/{project_id}`
- `POST /v1/projects/{project_id}/profile`
- `POST /v1/projects/{project_id}/train`
- `GET /v1/jobs/{job_id}`
- `GET /v1/models`
- `GET /v1/models/{model_id}`
- `POST /v1/models/{model_id}/predict`
- `POST /v1/models/{model_id}/deployments`

Enable local API key auth:

```powershell
$env:SITAKA_API_KEY = "change-me"
sitaka server
```

Then send:

```http
X-API-Key: change-me
```

## Remote Server Usage Without Local Install

Users do not need SITAKA installed on their local PC. You have two remote-first options.

### Option 1: No Docker, Remote Python Virtualenv

This is the easiest path if Docker is not comfortable.

Push the repo to GitHub, then run this on a remote Linux/macOS server:

```bash
SITAKA_REPO_URL=https://github.com/<your-github-user-or-org>/<your-repo>.git sh -c "$(curl -fsSL https://raw.githubusercontent.com/<your-github-user-or-org>/<your-repo>/main/scripts/remote-install.sh)"
```

For a Windows PowerShell server:

```powershell
$env:SITAKA_REPO_URL="https://github.com/<your-github-user-or-org>/<your-repo>.git"; irm https://raw.githubusercontent.com/<your-github-user-or-org>/<your-repo>/main/scripts/remote-install.ps1 | iex
```

Then open:

```text
http://<server-ip>:8000
http://<server-ip>:8000/docs
```

This clones the repo, creates `.venv`, installs SITAKA, and starts the API server.

### Option 2: Docker Or Podman

Docker is optional. Podman is a good open-source alternative on Linux.

After pushing this repo to GitHub, GitHub Actions publishes:

```text
ghcr.io/<your-github-user-or-org>/<your-repo>:latest
```

Run on any remote server with Docker:

```bash
docker run -d --name sitaka-api -p 8000:8000 -v sitaka_workspace:/workspace ghcr.io/<your-github-user-or-org>/<your-repo>:latest
```

Then open:

```text
http://<server-ip>:8000
http://<server-ip>:8000/docs
```

For a secure API key:

```bash
docker run -d --name sitaka-api -p 8000:8000 -e SITAKA_API_KEY=change-me -v sitaka_workspace:/workspace ghcr.io/<your-github-user-or-org>/<your-repo>:latest
```

See [`docs/remote-deployment.md`](docs/remote-deployment.md) for one-line bootstrap scripts, Docker Compose, data upload, and GitHub package visibility.

See [`docs/no-docker-deployment.md`](docs/no-docker-deployment.md) for the no-Docker remote server setup, Podman alternative, and Codespaces option.

## Python SDK

```python
from sitaka_api.config import SitakaConfig
from sitaka_api.sdk import SitakaClient

client = SitakaClient("http://127.0.0.1:8000")

config = SitakaConfig(
    project_name="iris-demo",
    task="tabular_classification",
    data={
        "source": "examples/tabular_classification/iris.csv",
        "format": "csv",
        "target": "species",
    },
    automl={"enabled_models": ["linear"], "n_trials": 1, "cv_folds": 2},
    mlflow={"enabled": False},
)

project = client.create_project(config, project_id="iris-demo")
job = client.train_project(project["project_id"])
model_id = job["result"]["model_id"]
prediction = client.predict(model_id, [{
    "sepal_length": 5.1,
    "sepal_width": 3.5,
    "petal_length": 1.4,
    "petal_width": 0.2,
}])
```

## Example Gallery

The [`examples/`](examples/) folder contains copy-ready projects:

| Example | Task | Status |
| --- | --- | --- |
| [`tabular_classification`](examples/tabular_classification/) | Iris species classification | End-to-end |
| [`tabular_regression`](examples/tabular_regression/) | Housing price prediction | End-to-end |
| [`nlp_classification`](examples/nlp_classification/) | Review sentiment | Baseline |
| [`nlp_regression`](examples/nlp_regression/) | Ticket priority score | Baseline |
| [`time_series_forecasting`](examples/time_series_forecasting/) | Daily sales forecast | Baseline |
| [`image_classification`](examples/image_classification/) | Image manifest classification | Scaffold |

Every trained bundle can be generated as any supported deployment framework:

```powershell
sitaka deploy --config examples/tabular_classification/sitaka.yaml --framework fastapi
sitaka deploy --config examples/tabular_classification/sitaka.yaml --framework flask
sitaka deploy --config examples/tabular_classification/sitaka.yaml --framework streamlit
sitaka deploy --config examples/tabular_classification/sitaka.yaml --framework django
```

## Generated Service Contract

Generated apps expose:

- `GET /health`
- `GET /ready`
- `GET /metadata`
- `GET /schema`
- `POST /predict`
- `POST /predict/batch`

Prediction payload:

```json
{
  "records": [
    {
      "sepal_length": 5.1,
      "sepal_width": 3.5,
      "petal_length": 1.4,
      "petal_width": 0.2
    }
  ]
}
```

## Documentation

- [`docs/index.md`](docs/index.md): documentation map and reading path.
- [`docs/architecture.md`](docs/architecture.md): product architecture and module boundaries.
- [`docs/api.md`](docs/api.md): FastAPI product API reference.
- [`docs/configuration.md`](docs/configuration.md): complete `sitaka.yaml` guide.
- [`docs/deployment.md`](docs/deployment.md): generated service deployment guide.
- [`docs/gitlab-package-registry.md`](docs/gitlab-package-registry.md): private GitLab package registry publishing and install.
- [`docs/operations.md`](docs/operations.md): running SITAKA as a product API.
- [`docs/no-docker-deployment.md`](docs/no-docker-deployment.md): no-Docker remote server install with one command.
- [`docs/pypi-publishing.md`](docs/pypi-publishing.md): publish package so users can run `pip install sitaka-api`.
- [`docs/remote-deployment.md`](docs/remote-deployment.md): running SITAKA on a server without local Python install.
- [`docs/sdk.md`](docs/sdk.md): Python SDK usage.
- [`docs/security.md`](docs/security.md): auth, roles, and audit behavior.
- [`docs/roadmap.md`](docs/roadmap.md): roadmap toward advanced MLOps and 2026 AI capabilities.

## Development

```powershell
pip install -e ".[dev,deploy,parquet]"
python -m pytest
python -m ruff check .
```

Current verification target:

- Unit tests for config, examples, workflow services, generated services, and platform API.
- API integration tests with FastAPI `TestClient`.
- Ruff linting.

## Roadmap Highlights

Near-term priorities:

- Data quality reports and quality gates.
- Batch prediction command for CSV/Parquet inputs.
- Explainability artifacts for tabular models.
- Model promotion workflow: staging to production.
- Pipeline generators for Airflow and Dagster.
- Drift monitoring and retraining triggers.
- Plugin system for custom connectors, models, and deployers.

See [`docs/roadmap.md`](docs/roadmap.md) for the full roadmap.
