Extracted from three near-identical bespoke implementations (Heretic, HordeWorker, InfiniteVideo), each ~800-1000 lines hand-rolling the same status/setup/login/logout/TOTP/admin-user-CRUD proxy around AuthClient. build_auth_router(get_client, get_store) returns a ready-to-mount APIRouter matching shared/backend/auth (Go)'s Service response shapes. Gated behind an optional `fastapi` extra so the rest of this framework-agnostic package is unaffected. 18 new tests, including a regression test for a real bug this had (request models nested inside build_auth_router silently broke under `from __future__ import annotations`, misrouting every JSON body as a missing query param). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
1019 B
TOML
35 lines
1019 B
TOML
[build-system]
|
|
requires = ["setuptools>=68"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "gabriel20xx-shared-backend"
|
|
version = "0.1.1"
|
|
description = "Shared PostgreSQL and authentication primitives for Python services."
|
|
readme = "README.md"
|
|
requires-python = ">=3.10"
|
|
license = { text = "MIT" }
|
|
dependencies = [
|
|
"asyncpg>=0.30",
|
|
"bcrypt>=4.2",
|
|
]
|
|
|
|
# Optional: only shared_backend.authproxy needs these (a FastAPI-specific
|
|
# AuthGuard-proxy router builder). The rest of this package stays
|
|
# framework-agnostic by design - see authclient.py's module docstring.
|
|
# Install with `pip install gabriel20xx-shared-backend[fastapi]`; a consumer
|
|
# that already depends on FastAPI directly (as every current authproxy
|
|
# consumer does) satisfies this from its own requirements regardless.
|
|
[project.optional-dependencies]
|
|
fastapi = ["fastapi>=0.100", "pydantic>=2"]
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["src"]
|
|
|
|
[tool.ruff]
|
|
target-version = "py310"
|
|
line-length = 100
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I"]
|