Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: version and description pulled from toml (#33) #35

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@
from fastapi.responses import RedirectResponse
from routers.health import health_router
from routers.mtcars import data_output
from docs.documentation import description
import uvicorn
import tomllib

try:
with open("pyproject.toml", "rb") as f:
tomldata = tomllib.load(f)
version = tomldata["project"]["version"]
description = tomldata["project"]["description"]
except FileNotFoundError:
print("pyproject.toml not found")

app = FastAPI(
# This info goes directly into /docs
title="RMI Web API poc",
# Description of API defined in docs/documentation.py for ease of reading
description=description,
summary="This project is a proof-of-concept (POC) web API built using the FastAPI library.",
version="0.0.1",
version=version,
contact={
"name": "RMI",
"url": "https://github.com/RMI",
Expand Down