REST API for Riftbound catalogue, collections, decks, validation, and analysis.
Project description
riftbound-api
API REST FastAPI pour consulter les données Riftbound, gérer des collections et
des decks, puis orchestrer la validation et l'analyse via riftbound-core
et riftbound-database.
Version actuelle : 0.6.0 (pré-1.0, persistance PostgreSQL collection/decks).
Installation
Prérequis : Python 3.12 ou 3.13.
python -m pip install riftbound-api
Avec le driver PostgreSQL recommandé en production :
python -m pip install "riftbound-api[postgres]"
Développement local :
python -m pip install -e ".[dev]"
Démarrage rapide
export RIFTBOUND_DATABASE_URL="postgresql+psycopg://user:password@localhost:5432/riftbound"
uvicorn riftbound_api.main:app --host 0.0.0.0 --port 8000
Sans base configurée, les routes catalogue, collection et decks renvoient
503 DATABASE_UNAVAILABLE.
Documentation interactive : GET /docs et GET /openapi.json.
Configuration
| Variable | Obligatoire | Défaut | Rôle |
|---|---|---|---|
RIFTBOUND_DATABASE_URL |
Oui (prod) | — | URL PostgreSQL (postgresql+psycopg://…) |
RIFTBOUND_API_ENV |
Non | development |
Environnement |
RIFTBOUND_API_LOG_LEVEL |
Non | INFO |
Niveau de log JSON |
RIFTBOUND_API_CORS_ORIGINS |
Non | vide | Origines CORS autorisées |
RIFTBOUND_API_AUTH_MODE |
Non | disabled |
disabled, api_key ou oidc (réservé) |
RIFTBOUND_API_DEV_USER_ID |
Non | dev-user |
Utilisateur injecté en mode disabled |
RIFTBOUND_API_API_KEYS |
Non | vide | Clés API key:user_id ou JSON |
Les secrets ne sont jamais loggés. Chaque réponse d'erreur inclut un request_id
(X-Request-Id).
Endpoints principaux
| Domaine | Exemples |
|---|---|
| Système | GET /health, GET /version |
| Catalogue | GET /cards, GET /cards/{card_id} |
| Références | GET /sets, GET /rules/current, GET /keywords, GET /formats |
| Collection | GET /collections/me, POST /collections/me/cards |
| Decks | GET /decks, POST /decks, POST /decks/{id}/validate, POST /decks/{id}/analyze |
| Import/export | POST /decks/import, POST /decks/{id}/export |
| Validation inline | POST /deck-validation |
Spécification complète : docs/.
Migrations base de données
Les migrations sont fournies par riftbound-database :
python -m pip install riftbound-database
riftbound-db upgrade
Tests d'intégration PostgreSQL
Prérequis locaux : Docker.
Les tests marqués postgresql démarrent automatiquement un conteneur éphémère
(docker compose, projet riftbound-api-pytest) puis l'arrêtent et le suppriment
à la fin de la session pytest.
python -m pytest -m postgresql -q
Pour réutiliser une base déjà disponible (CI ou instance locale) :
export RIFTBOUND_TEST_POSTGRESQL_URL="postgresql+psycopg://postgres:postgres@localhost:5432/riftbound_test"
python -m pytest -m postgresql -q
Pour un PostgreSQL manuel persistant (hors pytest) :
docker compose up -d
Limitations connues (0.6.0)
- Authentification OIDC :
RIFTBOUND_API_AUTH_MODE=oidcest réservé et rejeté au démarrage. - Snapshots de validation API : repository mémoire process (non persistés PostgreSQL).
- Snapshots d'analyse deck : non implémentés côté API.
Frontière de persistance
riftbound-api dépend de riftbound-database pour le provider, les sessions,
les repositories catalogue, les transactions et les migrations. baobab-database
reste encapsulé et n'est jamais utilisé directement par l'API.
SQLAlchemy est déclaré uniquement pour classifier ses exceptions publiques lors du mapping HTTP. L'API ne définit aucun modèle, repository, moteur ou migration SQLAlchemy propre.
Qualité
python -m ruff check .
python -m mypy src tests
python -m coverage run -m pytest -m "not integration and not postgresql" -q
python -m coverage report --fail-under=85
Licence
MIT — voir LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file riftbound_api-0.6.0.tar.gz.
File metadata
- Download URL: riftbound_api-0.6.0.tar.gz
- Upload date:
- Size: 148.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d88643c9189ad10e54c14a06b08ead3cb0dc77b7b28c65dcc23418f49da30d1c
|
|
| MD5 |
98cd99e99978e27bdb6c59af15711f7c
|
|
| BLAKE2b-256 |
5b9131e908892d4420bb6becbdd22af62d5c8e50c3672b072250c03aa0e63c0e
|
Provenance
The following attestation bundles were made for riftbound_api-0.6.0.tar.gz:
Publisher:
release.yml on baobabgit/riftbound-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riftbound_api-0.6.0.tar.gz -
Subject digest:
d88643c9189ad10e54c14a06b08ead3cb0dc77b7b28c65dcc23418f49da30d1c - Sigstore transparency entry: 1828622240
- Sigstore integration time:
-
Permalink:
baobabgit/riftbound-api@b5cbaa57e8046bb7375c82b079afff952718c812 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/baobabgit
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b5cbaa57e8046bb7375c82b079afff952718c812 -
Trigger Event:
push
-
Statement type:
File details
Details for the file riftbound_api-0.6.0-py3-none-any.whl.
File metadata
- Download URL: riftbound_api-0.6.0-py3-none-any.whl
- Upload date:
- Size: 126.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7318cadde0640911266279c205c3fcc60a85a8a414dc31578c002e9505b2e30e
|
|
| MD5 |
ebc7b9152f6cab3b93089c7fa3632c5d
|
|
| BLAKE2b-256 |
f0b94be112a20af5546c7d42865e57b7da914a570da0d02e0411e3afaf41337f
|
Provenance
The following attestation bundles were made for riftbound_api-0.6.0-py3-none-any.whl:
Publisher:
release.yml on baobabgit/riftbound-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riftbound_api-0.6.0-py3-none-any.whl -
Subject digest:
7318cadde0640911266279c205c3fcc60a85a8a414dc31578c002e9505b2e30e - Sigstore transparency entry: 1828622352
- Sigstore integration time:
-
Permalink:
baobabgit/riftbound-api@b5cbaa57e8046bb7375c82b079afff952718c812 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/baobabgit
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b5cbaa57e8046bb7375c82b079afff952718c812 -
Trigger Event:
push
-
Statement type: