generated from EPFL-ENAC/enac-it4r-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: restructure lidar API into addlidar-api package and update depe…
…ndencies
- Loading branch information
Showing
25 changed files
with
829 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ __pycache__/ | |
.Python | ||
env/ | ||
venv/ | ||
.venv | ||
ENV/ | ||
*.egg-info/ | ||
.installed.cfg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.11.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM python:3.12-slim | ||
|
||
# Install uv. | ||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ | ||
|
||
# Copy the application into the container. | ||
COPY . /app | ||
|
||
# Install the application dependencies. | ||
WORKDIR /app | ||
RUN uv sync --frozen --no-cache | ||
|
||
# Expose the application port to the host. | ||
EXPOSE 80 | ||
|
||
# Run the application. | ||
CMD ["/app/.venv/bin/fastapi", "run", "app/main.py", "--port", "80", "--host", "0.0.0.0", "--proxy-headers"] |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
AddLidar API application package. | ||
""" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from typing import Annotated | ||
from fastapi import Header, HTTPException | ||
|
||
async def get_token_header(x_token: Annotated[str, Header()]): | ||
if x_token != "fake-super-secret-token": | ||
raise HTTPException(status_code=400, detail="X-Token header invalid") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
Internal package for admin functionalities. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from fastapi import APIRouter, Depends | ||
from app.dependencies import get_token_header | ||
|
||
router = APIRouter( | ||
dependencies=[Depends(get_token_header)], | ||
responses={404: {"description": "Not found"}}, | ||
) | ||
|
||
@router.get("/") | ||
async def read_admin(): | ||
return {"message": "Admin getting schwifty"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from fastapi import FastAPI | ||
from app.routers import process_point_cloud | ||
from app.internal import admin | ||
|
||
app = FastAPI() | ||
|
||
# Include routers | ||
app.include_router(process_point_cloud.router, prefix="/api") | ||
app.include_router(admin.router, prefix="/admin", tags=["admin"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
Router package for API endpoints. | ||
""" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 4 additions & 7 deletions
11
lidar-api/docker-compose.yml → addlidar-api/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[project] | ||
name = "addlidar-api" | ||
version = "0.1.0" | ||
description = "FastAPI application for LiDAR data processing" | ||
readme = "README.md" | ||
requires-python = ">=3.11.5" | ||
dependencies = [ | ||
"docker>=7.1.0", | ||
"fastapi[standard]>=0.115.8", | ||
"httpx>=0.28.1", | ||
"pydantic>=2.10.6", | ||
"python-dotenv>=1.0.1", | ||
"uvicorn>=0.34.0", | ||
] | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = ["tests"] | ||
python_files = ["test_*.py", "*_test.py"] |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.