Metadata-Version: 2.4
Name: salute-api
Version: 0.1.0
Summary: Shared FastAPI runtime for Salute NLP scenarios
Keywords: salute,fastapi,smartapp,nlp
Author: aaraevskiy
Author-email: aaraevskiy <aaraevskiy@sberdevices.ru>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: fastapi>=0.128.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.13.5
Requires-Dist: redis>=7.0.0
Requires-Dist: sentry-sdk>=2.19.0
Requires-Python: >=3.14
Project-URL: Homepage, https://pypi.org/project/salute-api/
Description-Content-Type: text/markdown

# salute-api

Shared FastAPI runtime for Salute NLP scenarios: webhook, health, Pydantic message models, device-aware logging, and a MetricsSender protocol.

Install from PyPI:

```bash
pip install salute-api
# or
uv add salute-api
```

Quiz apps can still path-depend on a local checkout:

```toml
dependencies = ["salute-api"]

[tool.uv.sources]
salute-api = { path = "../salute-api", editable = true }
```

## Layout

```
src/salute_api/   FastAPI factory, models, logging, metrics, scenario walker
tests/            contract and logging tests
ci/pipeline.py    release version and API compatibility checks
```

Ruff and ty settings in this `pyproject.toml` are the shared baseline. Apps extend the ruff config with:

```toml
[tool.ruff]
extend = "../salute-api/pyproject.toml"
```

## Checks

```bash
uv sync
uv run ruff check .
uv run ruff format --check .
uv run ty check src tests
uv run pytest
uv run python ci/pipeline.py check
```

## Release

`version` in `pyproject.toml` and `__version__` in `src/salute_api/__init__.py` must be the same numeric `x.x.x`. On the default branch, GitLab CI lints, tests, classifies the API diff as patch, minor, or major, writes that version, rebuilds, and waits. The `deploy` job is manual. It tags `vX.Y.Z` and uploads `dist/` to PyPI.

Set masked CI variables before deploying:

- `UV_PUBLISH_TOKEN` — PyPI API token from <https://pypi.org/manage/account/token/>
- `GITLAB_TOKEN` — project token with `write_repository`, used to push the release commit and tag

Tag pipelines are skipped, so the tag push does not publish again.

Local build:

```bash
uv build
uv publish
# or with an explicit token:
# uv publish --token $UV_PUBLISH_TOKEN
```
