From 37254562570cdd8eb6caf18837f758ce605709d1 Mon Sep 17 00:00:00 2001 From: GotthardG <51994228+GotthardG@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:44:36 +0100 Subject: [PATCH] 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. --- backend/main.py | 11 ++++------- make_openapi_client.sh | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/backend/main.py b/backend/main.py index f3f76db..95766b2 100644 --- a/backend/main.py +++ b/backend/main.py @@ -28,14 +28,11 @@ def get_project_metadata(): from pathlib import Path import tomllib - # Dynamically resolve the correct path to pyproject.toml - root_dir = ( - Path(__file__).resolve().parent.parent.parent - ) # Adjust path to project root - pyproject_path = root_dir / "pyproject.toml" + # Adjust path resolution to pinpoint the actual folder containing `pyproject.toml` + root_dir = Path(__file__).resolve().parent.parent.parent # Root of the repository + pyproject_path = root_dir / "pyproject.toml" # Update properly - # Print the resolved path for debugging - print(f"Looking for pyproject.toml at: {pyproject_path}") + print(f"Looking for pyproject.toml at: {pyproject_path}") # Debug output if not pyproject_path.exists(): raise FileNotFoundError(f"{pyproject_path} not found") diff --git a/make_openapi_client.sh b/make_openapi_client.sh index ec6c6c0..8a161b2 100755 --- a/make_openapi_client.sh +++ b/make_openapi_client.sh @@ -1,7 +1,7 @@ #!/bin/bash # Extract values from pyproject.toml -PYPROJECT_FILE="$(dirname "$0")/heidi-v2/pyproject.toml" +PYPROJECT_FILE="$(dirname "$0")/pyproject.toml" VERSION=$(grep -Po '(?<=version = ")[^"]*' "$PYPROJECT_FILE") NAME=$(grep -Po '(?<=name = ")[^"]*' "$PYPROJECT_FILE")