Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

💩(summary) init a FastAPI app

lebaudantoine16bee00eb40c
diff --git a/src/summary/pyproject.toml b/src/summary/pyproject.toml
new file mode 100644
index 00000000..19cf3fd8
--- /dev/null
+++ b/src/summary/pyproject.toml
@@ -0,0 +1,59 @@
+
+[project]
+name = "summary"
+version = "0.1.0"
+dependencies = [
+ "fastapi[standard]>=0.105.0",
+ "uvicorn>=0.24.0",
+ "pydantic>=2.5.0",
+ "pydantic-settings>=2.1.0",
+]
+
+[project.optional-dependencies]
+dev = [
+ "ruff==0.7.4",
+]
+
+[build-system]
+requires = ["setuptools>=61.0"]
+build-backend = "setuptools.build_meta"
+
+
+[tool.ruff]
+target-version = "py310"
+
+[tool.ruff.lint]
+select = [
+ "B", # flake8-bugbear
+ "C4", # flake8-comprehensions
+ "D", # pydocstyle
+ "E", # pycodestyle error
+ "F", # Pyflakes
+ "I", # Isort
+ "ISC", # flake8-implicit-str-concat
+ "PLC", # Pylint Convention
+ "PLE", # Pylint Error
+ "PLR", # Pylint Refactor
+ "PLW", # Pylint Warning
+ "RUF100", # Ruff unused-noqa
+ "S", # flake8-bandit
+ "T20", # flake8-print
+ "W", # pycodestyle warning
+]
+
+[tool.ruff.lint.per-file-ignores]
+"tests/*" = [
+ "S101", # use of assert
+]
+
+[tool.ruff.lint.pydocstyle]
+# Use Google-style docstrings.
+convention = "google"
+
+[tool.ruff.lint.flake8-bugbear]
+extend-immutable-calls = [
+ "fastapi.Depends",
+ "fastapi.params.Depends",
+ "fastapi.params.Query",
+ "fastapi.Query",
+]
diff --git a/src/summary/summary/__init__.py b/src/summary/summary/__init__.py
new file mode 100644
index 00000000..9d1d7e03
--- /dev/null
+++ b/src/summary/summary/__init__.py
@@ -0,0 +1 @@
+"""Summary package."""
diff --git a/src/summary/summary/config.py b/src/summary/summary/config.py
new file mode 100644
index 00000000..cacb93d9
--- /dev/null
+++ b/src/summary/summary/config.py
@@ -0,0 +1,10 @@
+"""Module for managing application configuration and settings."""
+
+from pydantic_settings import BaseSettings, SettingsConfigDict
+
+
+class Settings(BaseSettings):
+ """Configuration settings loaded from environment variables and .env file."""
+
+ app_name: str = "Awesome API"
+ model_config = SettingsConfigDict(env_file=".env")
diff --git a/src/summary/summary/main.py b/src/summary/summary/main.py
new file mode 100644
index 00000000..98743299
--- /dev/null
+++ b/src/summary/summary/main.py
@@ -0,0 +1,33 @@
+"""Application entry point."""
+
+from functools import lru_cache
+from typing import Annotated
+
+from config import Settings
+from fastapi import Depends, FastAPI
+
+app = FastAPI()
+
+
+@lru_cache
+def get_settings():
+ """Load and cache application settings."""
+ return Settings()
+
+
+async def root(settings: Annotated[Settings, Depends(get_settings)]):
+ """Root endpoint that returns app name."""
+ return {"message": f"Hello World, using {settings.app_name}"}
+
+
[email protected]("/__heartbeat__")
+async def heartbeat():
+ """Health check endpoint for monitoring."""
+ return {"status": "ok"}
+
+
[email protected]("/__lbheartbeat__")
+async def lbheartbeat():
+ """Health check endpoint for load balancer."""
+ return {"status": "ok"}