feat: stage0 — init Python package, FastAPI health endpoint, tests

This commit is contained in:
Yuzviak
2026-03-22 22:10:09 +02:00
parent 6a48dd29fd
commit 6ba883f4d6
6 changed files with 124 additions and 0 deletions
+25
View File
@@ -1,2 +1,27 @@
# OS
.DS_Store .DS_Store
.idea .idea
.vscode
# Python
__pycache__/
*.py[cod]
*.egg-info/
dist/
.venv/
.ruff_cache/
# Secrets
.env
.env.*
# Data & Models (large files, local only)
data/
weights/
# Database
*.db
*.sqlite3
# Tile cache
tile_cache/
+41
View File
@@ -0,0 +1,41 @@
[project]
name = "gps-denied-onboard"
version = "0.1.0"
description = "GPS-denied UAV geolocalization service"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.115",
"uvicorn[standard]>=0.34",
"pydantic>=2.0",
"pydantic-settings>=2.0",
"sqlalchemy>=2.0",
"alembic>=1.14",
"sse-starlette>=2.0",
"aiosqlite>=0.20",
]
[project.optional-dependencies]
dev = [
"ruff>=0.9",
"pytest>=8.0",
"pytest-asyncio>=0.24",
"httpx>=0.28",
]
[build-system]
requires = ["setuptools>=75"]
build-backend = "setuptools.build_meta"
[tool.setuptools.packages.find]
where = ["src"]
[tool.ruff]
target-version = "py311"
line-length = 100
[tool.ruff.lint]
select = ["E", "F", "I", "W"]
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
+3
View File
@@ -0,0 +1,3 @@
"""GPS-Denied Onboard — UAV geolocalization service."""
__version__ = "0.1.0"
+16
View File
@@ -0,0 +1,16 @@
"""Entry point: python -m gps_denied."""
import uvicorn
def main() -> None:
uvicorn.run(
"gps_denied.app:app",
host="127.0.0.1",
port=8000,
reload=True,
)
if __name__ == "__main__":
main()
+23
View File
@@ -0,0 +1,23 @@
"""FastAPI application factory."""
from fastapi import FastAPI
from gps_denied import __version__
def create_app() -> FastAPI:
"""Create and configure the FastAPI application."""
application = FastAPI(
title="GPS-Denied Onboard",
version=__version__,
description="UAV geolocalization service for GPS-denied environments",
)
@application.get("/health")
async def health() -> dict:
return {"status": "ok"}
return application
app = create_app()
+16
View File
@@ -0,0 +1,16 @@
"""Tests for the health endpoint."""
import pytest
from httpx import ASGITransport, AsyncClient
from gps_denied.app import app
@pytest.mark.asyncio
async def test_health_returns_ok():
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url="http://test") as client:
response = await client.get("/health")
assert response.status_code == 200
assert response.json() == {"status": "ok"}