Files
ENI-projet-piscine/apps/backend/pyproject.toml
T
Johan LEROY 20e7374d90 feat(backend): verifie l extension TimescaleDB sur la sonde de disponibilite
/api/v1/health/ready interrogeait la base par un SELECT 1, qui ne distingue
pas un PostgreSQL nu d'un PostgreSQL avec TimescaleDB. La sonde lit desormais
pg_extension et repond 503 si l'extension manque, cas qui survient quand
db/init n'a pas ete joue.

- Premiere revision Alembic : aucune table, une garde qui refuse de
  s'appliquer sans l'extension.
- Tests du chemin nominal et de l'extension absente, plus un test marque
  `integration` contre la vraie base. pytest ecarte ce marqueur par defaut
  pour que make check reste jouable sans Docker.
- conftest recycle l'engine entre les tests : get_engine est lru_cache alors
  que pytest-asyncio ouvre une boucle par test, et les connexions asyncpg
  sont liees a leur boucle.
2026-09-14 14:19:25 +02:00

88 lines
1.7 KiB
TOML

[project]
name = "enervision-backend"
version = "0.1.0"
description = "API EnerVision : exposition des series temporelles energetiques"
requires-python = ">=3.14,<3.15"
dependencies = [
"fastapi>=0.141.1",
"uvicorn[standard]>=0.53.0",
"pydantic>=2.13.5",
"pydantic-settings>=2.15.0",
"sqlalchemy[asyncio]>=2.0.52",
"asyncpg>=0.31.0",
"alembic>=1.20.0",
"prometheus-fastapi-instrumentator>=8.1.0",
"python-json-logger>=4.2.0",
]
[dependency-groups]
dev = [
"ruff>=0.16.7",
"mypy>=2.3.1",
"pytest>=9.1.1",
"pytest-asyncio>=1.4.0",
"pytest-cov>=7.1.0",
"httpx>=0.28.1",
]
[build-system]
requires = ["hatchling>=1.32.0"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["app"]
[tool.ruff]
line-length = 100
target-version = "py314"
src = ["app", "tests"]
extend-exclude = ["alembic/versions"]
[tool.ruff.lint]
select = [
"E", "W",
"F",
"I",
"N",
"UP",
"B",
"C4",
"SIM",
"TID",
"RUF",
"ASYNC",
"S",
"PT",
]
ignore = ["B008"]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101"]
[tool.ruff.lint.isort]
known-first-party = ["app"]
[tool.ruff.format]
quote-style = "double"
[tool.mypy]
python_version = "3.14"
strict = true
warn_unreachable = true
plugins = ["pydantic.mypy"]
exclude = ["^alembic/"]
[[tool.mypy.overrides]]
module = ["tests.*"]
disallow_untyped_defs = false
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
addopts = "-q --strict-markers -m 'not integration' --cov=app --cov-report=term-missing"
markers = ["integration: requiert une base PostgreSQL joignable, hors `make test`"]
[tool.coverage.run]
source = ["app"]
omit = ["app/main.py", "alembic/*"]