feat: versioning sémantique (single source of truth)

- Crée src/__version__.py comme source unique de version (2.1.0)
- pyproject.toml utilise dynamic version via setuptools attr
- Affiche la version dans le footer de la sidebar (base.html)
- Ajoute endpoint /health avec version et status

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dom
2026-03-08 11:47:44 +01:00
parent 214a5d1914
commit 5b58886ebf
4 changed files with 17 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
[project]
name = "t2a"
version = "2.0.0"
dynamic = ["version"]
description = "Pipeline de codage CIM-10/CCAM automatise pour le PMSI hospitalier"
readme = "README.md"
requires-python = ">=3.11"
@@ -43,6 +43,9 @@ dev = [
[project.scripts]
t2a = "src.main:main"
[tool.setuptools.dynamic]
version = {attr = "src.__version__.__version__"}
[tool.setuptools.packages.find]
include = ["src*"]

3
src/__version__.py Normal file
View File

@@ -0,0 +1,3 @@
"""Version unique du projet T2A v2 (single source of truth)."""
__version__ = "2.1.0"

View File

@@ -22,6 +22,7 @@ from ..config import (
ALLOWED_EXTENSIONS, UPLOAD_MAX_SIZE_MB,
)
from .. import config as cfg
from ..__version__ import __version__ as APP_VERSION
from ..control.cpam_context import _assess_dossier_strength
from ..medical.bio_normals import BIO_NORMALS
from .referentiels import ReferentielManager
@@ -102,7 +103,12 @@ def create_app() -> Flask:
rep = item
break
dossier_list.append({"name": format_dossier_name(group_name), "path": rep["path_rel"]})
return {"dossier_list": dossier_list}
return {"dossier_list": dossier_list, "app_version": APP_VERSION}
# --- Health check ---
@app.route("/health")
def health():
return jsonify({"status": "ok", "version": APP_VERSION})
# ===================================================================
# Routes principales

View File

@@ -421,6 +421,9 @@
<input type="text" id="sidebar-search" placeholder="Rechercher un dossier…" autocomplete="off">
<div id="sidebar-autocomplete" style="display:none;position:absolute;left:0;right:0;background:#0f172a;border:1px solid #475569;border-radius:0 0 6px 6px;max-height:250px;overflow-y:auto;z-index:100;"></div>
</div>
<div style="padding:0.5rem 1rem;border-top:1px solid #334155;font-size:0.6rem;color:#475569;text-align:center;">
v{{ app_version }}
</div>
</aside>
<!-- Main -->