Metadata-Version: 2.4
Name: zecmf
Version: 0.2.2
Summary: A framework for building microservices in Python
Author-email: Hendrik Buchwald <hb@zecure.org>
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: Flask<4.0,>=3.1
Requires-Dist: Werkzeug<4.0,>=3.1
Requires-Dist: Jinja2<4.0,>=3.1
Requires-Dist: click<9.0,>=8.1
Requires-Dist: Flask-Cors<7.0,>=6.0
Requires-Dist: Flask-JWT-Extended!=4.7.2,!=4.7.3,<5.0,>=4.6
Requires-Dist: Flask-Migrate<5.0,>=4.0
Requires-Dist: Flask-RESTX<2.0,>=1.3
Requires-Dist: Flask-SQLAlchemy<4.0,>=3.1
Requires-Dist: SQLAlchemy<3.0,>=2.0
Requires-Dist: PyJWT[crypto]<3.0,>=2.11
Requires-Dist: python-dotenv<2.0,>=1.0
Provides-Extra: celery
Requires-Dist: celery<6.0,>=5.4; extra == "celery"
Provides-Extra: clients
Requires-Dist: requests<3.0,>=2.31; extra == "clients"
Requires-Dist: jsonschema<5.0,>=4.20; extra == "clients"
Provides-Extra: zecure-clients
Requires-Dist: zecmf[clients]; extra == "zecure-clients"
Provides-Extra: ratelimit
Requires-Dist: Flask-Limiter<4.0,>=3.5; extra == "ratelimit"
Provides-Extra: metrics
Requires-Dist: prometheus-client<1.0,>=0.20; extra == "metrics"
Provides-Extra: test
Requires-Dist: pytest<9.0,>=8.0; extra == "test"
Requires-Dist: pytest-cov<7.0,>=5.0; extra == "test"
Provides-Extra: lint
Requires-Dist: ruff<1.0,>=0.6; extra == "lint"
Provides-Extra: typecheck
Requires-Dist: mypy<2.0,>=1.12; extra == "typecheck"
Requires-Dist: types-Flask-Migrate>=4.1; extra == "typecheck"
Requires-Dist: types-Flask-Cors>=4.0; extra == "typecheck"
Requires-Dist: types-jsonschema>=4.20; extra == "typecheck"
Requires-Dist: types-requests>=2.31; extra == "typecheck"
Provides-Extra: dev
Requires-Dist: zecmf[celery,clients,lint,metrics,ratelimit,test,typecheck,zecure-clients]; extra == "dev"

# Zecure Microservices Framework (ZecMF)

A lightweight framework for building microservices in Python with Flask.

## Features

- **Application Factory**: Streamlined Flask application initialization that wires
  database, Celery, auth, CORS, observability, health, security headers and the
  error envelope in one call.
- **JWT Authentication**: Default-deny auth with RS256/HS256, RBAC decorators,
  normalized role claims, optional audience/issuer scoping, and typed current-user
  accessors.
- **API Setup**: Flask-RESTX with a standardized JSON error envelope
  (`{message, code, details, request_id}`) and first-class pagination primitives.
- **Background Tasks**: Celery integration with an app-context `ContextTask` and a
  two-line worker bootstrap (`zecmf.worker.make_celery`), plus task monitoring.
- **Observability**: Configurable structured logging (`text`/`json`), per-request
  `X-Request-ID` correlation IDs, `/healthz` + `/readyz` probes, and an optional
  Prometheus `/metrics` endpoint.
- **Security**: Security response headers, optional rate limiting, and safe defaults.
- **Database**: SQLAlchemy 2.0 + Alembic integration and migration scaffolding.
- **Typed + Testable**: Ships `py.typed`, and a reusable `zecmf.testing.plugin`
  pytest plugin (`app`/`client`/`db`/token fixtures).
- **Configuration**: Hierarchical config with framework defaults and app overrides.

## Installation

```bash
pip install zecmf                       # core (web APIs, auth, DB)
pip install "zecmf[celery]"             # + background tasks
pip install "zecmf[clients]"            # + LLM/HTTP clients
pip install "zecmf[celery,clients]"     # 0.1-equivalent superset
# optional: zecmf[ratelimit], zecmf[metrics]
```

## Debugging

If you want to include the code in your application for debugging purposes, you can simply mount it:

```
    volumes:
      - ${HOME}/Repos/Zecure/zecmf/src/zecmf:/home/appuser/.local/lib/python3.12/site-packages/zecmf:ro
```
