Skip to main content

Persistence library for the Baobab AI development ecosystem.

Project description

baobab-ai-dev-database

Librairie de persistance de l'écosystème baobab-ai-development.

Le module fournit la configuration database, les sessions et transactions, les modèles ORM, les mappers, les repositories, les migrations Alembic et les services de lecture nécessaires aux workflows de développement IA.

Prérequis

  • Python 3.12 ou supérieur
  • pip

Installation

Depuis PyPI

python -m pip install baobab-ai-dev-database

L'installation standard cible PostgreSQL et résout :

  • baobab-ai-dev-core>=0.2,<1 (version PyPI courante : 0.2.0)
  • baobab-database[postgresql]>=2,<3 (version PyPI courante : 2.0.0)
  • alembic>=1,<2

Développement (dépôt local)

python -m pip install -e ".[dev]"

Usage de base

Configuration et session

Les variables d'environnement BAOBAB_DB_* pilotent la connexion (voir .env.example et docs/configuration/environment-variables.md).

from baobab_ai_dev_database.config.database_settings import DatabaseSettings
from baobab_ai_dev_database.session.database_session_manager import DatabaseSessionManager

settings = DatabaseSettings().build()
manager = DatabaseSessionManager.from_settings(settings)

with manager.create_session() as session:
  # utiliser la session SQLAlchemy
  pass

Repositories

from baobab_ai_dev_database.repositories.repository_registry import RepositoryRegistry

registry = RepositoryRegistry(session)
project = registry.projects.get_by_slug("mon-projet")

Migrations Alembic

Les scripts de migration sont embarqués dans le wheel (env.py, script.py.mako, révisions sous versions/).

Le fichier alembic.ini à la racine de ce dépôt n'est pas publié sur PyPI : l'application consommatrice fournit sa propre configuration Alembic. Pointez script_location vers le répertoire packagé :

from baobab_ai_dev_database.migrations import MIGRATIONS_SCRIPT_LOCATION

print(MIGRATIONS_SCRIPT_LOCATION)

Exemple minimal de section [alembic] côté consommateur :

[alembic]
script_location = %(CHEMIN_VERS_MIGRATIONS_SCRIPT_LOCATION)s

Dans ce dépôt (développement), exécuter depuis la racine :

alembic upgrade head
alembic current

Documentation détaillée : docs/technical/alembic-migrations.md.

Validation

Quality gate agrégée et multiplateforme (sans shell) :

python -m baobab_ai_dev_database.quality

Commandes individuelles :

python -m pytest
coverage run -m pytest
coverage report
ruff check .
mypy backend/src

La documentation de l'arborescence interne et de la quality gate se trouve dans backend/README.md.

Publication PyPI (Trusted Publishing)

Le workflow .github/workflows/release.yml publie sur PyPI via OIDC (aucun token longue durée dans le dépôt).

Configuration côté PyPI (une fois par projet) :

  1. Compte PyPI → PublishingAdd a new pending publisher
  2. PyPI project name : baobab-ai-dev-database
  3. Owner : baobabgit (organisation GitHub du dépôt)
  4. Repository name : baobab-ai-dev-database
  5. Workflow name : release.yml
  6. Environment name : pypi

Créer ensuite l'environnement pypi dans les paramètres GitHub du dépôt (Settings → Environments) avant de pousser un tag v*.*.*.

Versionnement

  • Version actuelle du package : 0.1.0 (alpha).
  • Historique : CHANGELOG.md.

Licence

MIT — voir LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baobab_ai_dev_database-0.1.0.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baobab_ai_dev_database-0.1.0-py3-none-any.whl (115.5 kB view details)

Uploaded Python 3

File details

Details for the file baobab_ai_dev_database-0.1.0.tar.gz.

File metadata

  • Download URL: baobab_ai_dev_database-0.1.0.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for baobab_ai_dev_database-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d083cf84e398362b69797f61a05cdcbe8912e920fbfb81590867ac8bf5907693
MD5 096d8d682dc92b5b9e133af0d46b3390
BLAKE2b-256 c33693d7d49065c399c661b0ba839e6d3ca05acd3d9d52a931019487ab612331

See more details on using hashes here.

Provenance

The following attestation bundles were made for baobab_ai_dev_database-0.1.0.tar.gz:

Publisher: release.yml on baobabgit/baobab-ai-dev-database

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file baobab_ai_dev_database-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for baobab_ai_dev_database-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d91c94bc03602fde2d1fa9059b711670e9334735f2cdb47abc20722e03f41c6
MD5 2a95fc5a2d0d0c9fc462f87107ddbb41
BLAKE2b-256 441a9138d69c10633baa51b7425b62b4cacfedfacef8327b41166ac9f5c5fd28

See more details on using hashes here.

Provenance

The following attestation bundles were made for baobab_ai_dev_database-0.1.0-py3-none-any.whl:

Publisher: release.yml on baobabgit/baobab-ai-dev-database

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page