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
e5ccbf6ef1
commit
d3d87dc9a2
@ -4,14 +4,14 @@
|
|||||||
PYPROJECT_FILE="$(dirname "$0")/pyproject.toml"
|
PYPROJECT_FILE="$(dirname "$0")/pyproject.toml"
|
||||||
|
|
||||||
VERSION=$(grep -Po '(?<=version = ")[^"]*' "$PYPROJECT_FILE")
|
VERSION=$(grep -Po '(?<=version = ")[^"]*' "$PYPROJECT_FILE")
|
||||||
NAME=$(grep -Po '(?<=name = ")[^"]*' "$PYPROJECT_FILE" | tr -d '\n')
|
NAME=$(grep -Po '(?<=name = ")[^\"]*' "$PYPROJECT_FILE" | sed 's/[^a-zA-Z0-9_-]//g') # Extract name and sanitize it
|
||||||
|
|
||||||
if [[ -z "$VERSION" || -z "$NAME" ]]; then
|
if [[ -z "$VERSION" || -z "$NAME" ]]; then
|
||||||
echo "Error: Could not determine version or name from pyproject.toml"
|
echo "Error: Could not determine version or name from pyproject.toml"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure NAME is valid (no spaces or newlines)
|
# Ensure NAME is valid (no special characters or newlines)
|
||||||
if ! [[ "$NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
if ! [[ "$NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
||||||
echo "Error: Invalid project name detected: '$NAME'"
|
echo "Error: Invalid project name detected: '$NAME'"
|
||||||
exit 1
|
exit 1
|
||||||
@ -64,4 +64,4 @@ if [[ ! -d dist || -z "$(ls -A dist)" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Python package built successfully in 'dist/'. !"
|
echo "Python package built successfully in 'dist/'."
|
Loading…
x
Reference in New Issue
Block a user