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:
GotthardG 2024-12-17 10:54:34 +01:00
parent 455a22c7e6
commit 219cf93756
2 changed files with 12 additions and 9 deletions

View File

@ -60,15 +60,12 @@ release:
stage: release
when: manual
variables:
TWINE_USERNAME: gitlab-ci-token # Keep username same
TWINE_USERNAME: gitlab-ci-token # Keep username the same
TWINE_PASSWORD: $CI_JOB_TOKEN # Use PAT stored in GitLab CI/CD Variables
script:
- echo "Setting up Python dependencies..."
- source $VIRTUAL_ENV/bin/activate
- pip install -r requirements.txt
- bash make_openapi_client.sh
- cd backend/python-client # Navigate to the folder where the package was generated
- python -m venv .venv
- source .venv/bin/activate
- pip install -U pip twine
- twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
- bash make_openapi_client.sh # Generate OpenAPI client and package
- ls backend/python-client/dist/ # Debug artifacts to ensure files exist
- twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi backend/python-client/dist/*

View File

@ -44,11 +44,17 @@ if [[ ! -d python-client ]]; then
fi
# Build Python package
echo "Building Python package..."
cd python-client || exit
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip build
python -m build
# Skip uploading the package. This will happen in the release stage.
echo "Python client generated and package built successfully."
# Verify build output
if [[ ! -d dist || -z "$(ls -A dist)" ]]; then
echo "Error: No files generated in 'dist/'. Package build failed."
exit 1
fi
echo "Python package built successfully in 'dist/'."