code: Grundgerüst und FastAPI-Health-Endpoint
This commit is contained in:
35
.gitignore
vendored
35
.gitignore
vendored
@@ -1,27 +1,12 @@
|
||||
# Projekt-Scope: thesillyhome-reanalysis
|
||||
# Vermeide Störungen aus dem übergeordneten Workspace.
|
||||
|
||||
# Isolation: projektinterne Hüterdateien ignorieren,
|
||||
# aber keine Steuerdateien aus dem Workspace-Root stumm abschalten.
|
||||
!memory/
|
||||
!memory/*
|
||||
!second-brain/
|
||||
!second-brain/*
|
||||
|
||||
# Secrets und Umgebungsvariablen
|
||||
/venv
|
||||
/.venv
|
||||
/.idea
|
||||
/.vscode
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.mypy_cache/
|
||||
.pytest_cache/
|
||||
.ruff_cache/
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Vermischte Backup- und temporäre Dateien
|
||||
*.sqlite.bak
|
||||
*.sqlite.bak-*
|
||||
*.log
|
||||
*.tmp
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# Editor/IDE
|
||||
.idea
|
||||
.vscode
|
||||
*.code-workspace
|
||||
.env.*
|
||||
|
||||
17
app/main.py
Normal file
17
app/main.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI(
|
||||
title="SillyHome Next API",
|
||||
description="Lokales Smart-Home-Intelligenzsystem für Home Assistant.",
|
||||
version="0.1.0",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health() -> dict[str, str]:
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root() -> dict[str, str]:
|
||||
return {"service": "sillyhome-next", "docs": "/docs"}
|
||||
28
pyproject.toml
Normal file
28
pyproject.toml
Normal file
@@ -0,0 +1,28 @@
|
||||
[project]
|
||||
name = "sillyhome-next"
|
||||
version = "0.1.0"
|
||||
description = "Lokales Smart-Home-Intelligenzsystem für Home Assistant"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"fastapi>=0.110.0",
|
||||
"uvicorn[standard]>=0.29.0",
|
||||
"pydantic>=2.6.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=8.0.0",
|
||||
"ruff>=0.4.0",
|
||||
"mypy>=1.9.0",
|
||||
]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
addopts = "-q"
|
||||
|
||||
[tool.mypy]
|
||||
strict = true
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py311"
|
||||
10
tests/test_health.py
Normal file
10
tests/test_health.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from fastapi.testclient import TestClient
|
||||
from app.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_health_returns_ok() -> None:
|
||||
response = client.get("/health")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"status": "ok"}
|
||||
Reference in New Issue
Block a user