Sync project metadata with pyproject.toml
Updated scripts and backend to dynamically retrieve project name and version from `pyproject.toml`. This ensures consistent metadata across the OpenAPI client generation and the FastAPI application.
This commit is contained in:
parent
5dff380c65
commit
e4b2a15126
@ -26,7 +26,15 @@ from app.database import Base, engine, SessionLocal, load_sample_data
|
||||
|
||||
# Utility function to fetch metadata from pyproject.toml
|
||||
def get_project_metadata():
|
||||
with open("pyproject.toml", "rb") as f:
|
||||
# Dynamically resolve the correct path to pyproject.toml
|
||||
current_dir = Path(__file__).resolve().parent
|
||||
root_dir = current_dir.parent.parent # Adjust based on structure
|
||||
pyproject_path = root_dir / "pyproject.toml"
|
||||
|
||||
if not pyproject_path.exists():
|
||||
raise FileNotFoundError(f"pyproject.toml not found at {pyproject_path}")
|
||||
|
||||
with open(pyproject_path, "rb") as f:
|
||||
pyproject = tomllib.load(f)
|
||||
name = pyproject["project"]["name"]
|
||||
version = pyproject["project"]["version"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user