💬 Commit message: Update 2026-02-15 17:55:57, 7 files, 47 lines

📁 Files changed: 7
📝 Lines changed: 47

  • pyproject.toml
  • __init__.py
  • civitai_routes.py
  • db_routes.py
  • download_routes.py
  • gallery_routes.py
  • uv.lock
This commit is contained in:
Adam Ladachowski
2026-02-15 17:55:57 +01:00
parent 0ce7744324
commit 1d41f924bf
7 changed files with 41 additions and 6 deletions
+6 -1
View File
@@ -13,7 +13,7 @@ dependencies = [
]
[project.optional-dependencies]
server = ["fastapi>=0.115", "uvicorn>=0.30"]
server = ["fastapi>=0.115", "uvicorn>=0.30", "scalar-fastapi>=1.6"]
[project.scripts]
tsr = "tensors:main"
@@ -36,6 +36,7 @@ dev = [
"respx>=0.22.0",
"fastapi>=0.115",
"uvicorn>=0.30",
"scalar-fastapi>=1.6",
]
[tool.ruff]
@@ -92,6 +93,10 @@ ignore_missing_imports = true
module = ["uvicorn.*"]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = ["scalar_fastapi.*"]
ignore_missing_imports = true
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-v --cov=tensors --cov-report=term-missing"
+18 -1
View File
@@ -7,6 +7,7 @@ from contextlib import asynccontextmanager
from typing import TYPE_CHECKING
from fastapi import FastAPI
from scalar_fastapi import get_scalar_api_reference
from tensors.server.civitai_routes import create_civitai_router
from tensors.server.db_routes import create_db_router
@@ -16,6 +17,8 @@ from tensors.server.gallery_routes import create_gallery_router
if TYPE_CHECKING:
from collections.abc import AsyncIterator
from fastapi.responses import HTMLResponse
__all__ = ["app", "create_app"]
logger = logging.getLogger(__name__)
@@ -29,12 +32,26 @@ def create_app() -> FastAPI:
logger.info("Tensors server starting")
yield
app = FastAPI(title="tensors", lifespan=lifespan)
app = FastAPI(
title="tensors",
description="API for CivitAI model management and image gallery",
version="0.1.16",
lifespan=lifespan,
docs_url=None,
redoc_url=None,
)
@app.get("/status")
async def status() -> dict[str, str]:
return {"status": "ok"}
@app.get("/docs", include_in_schema=False)
async def scalar_docs() -> HTMLResponse:
return get_scalar_api_reference(
openapi_url=app.openapi_url or "/openapi.json",
title="tensors API",
)
app.include_router(create_civitai_router())
app.include_router(create_db_router())
app.include_router(create_gallery_router())
+1 -1
View File
@@ -14,7 +14,7 @@ from tensors.db import Database
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/civitai", tags=["civitai"])
router = APIRouter(prefix="/api/civitai", tags=["CivitAI"])
def _get_headers(api_key: str | None) -> dict[str, str]:
+1 -1
View File
@@ -15,7 +15,7 @@ from tensors.db import Database
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/db", tags=["database"])
router = APIRouter(prefix="/api/db", tags=["Database"])
# =============================================================================
+1 -1
View File
@@ -15,7 +15,7 @@ from tensors.db import Database
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/download", tags=["download"])
router = APIRouter(prefix="/api/download", tags=["Download"])
# Track active downloads
_active_downloads: dict[str, dict[str, Any]] = {}
+1 -1
View File
@@ -13,7 +13,7 @@ from tensors.server.gallery import Gallery
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/api/images", tags=["gallery"])
router = APIRouter(prefix="/api/images", tags=["Gallery"])
# Shared gallery instance
_gallery: Gallery | None = None
Generated
+13
View File
@@ -683,6 +683,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/5d/e6/ec8471c8072382cb91233ba7267fd931219753bb43814cbc71757bfd4dab/safetensors-0.7.0-cp38-abi3-win_amd64.whl", hash = "sha256:d1239932053f56f3456f32eb9625590cc7582e905021f94636202a864d470755", size = 341380, upload-time = "2025-11-19T15:18:44.427Z" },
]
[[package]]
name = "scalar-fastapi"
version = "1.6.2"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/69/27/4fefc485d6d3b32c59e48cc5d7ba20180dc15984b4b50cbc8a0da18670d6/scalar_fastapi-1.6.2.tar.gz", hash = "sha256:2aea052b8ebd585f8f4a71c2eeb4a7250f4dba1172aa056464ff0fe7ae49bdd5", size = 8069, upload-time = "2026-02-11T21:26:22.766Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/30/16/fafcc10900b1d330641444163adac525322628684d04dc24bd8d5ab7109a/scalar_fastapi-1.6.2-py3-none-any.whl", hash = "sha256:922ff1823a5bc5dc6b6df318a468e1a8401babc973e74ccbf79154f50de5e13f", size = 7443, upload-time = "2026-02-11T21:26:21.175Z" },
]
[[package]]
name = "shellingham"
version = "1.5.4"
@@ -720,6 +729,7 @@ dependencies = [
[package.optional-dependencies]
server = [
{ name = "fastapi" },
{ name = "scalar-fastapi" },
{ name = "uvicorn" },
]
@@ -733,6 +743,7 @@ dev = [
{ name = "pytest-cov" },
{ name = "respx" },
{ name = "ruff" },
{ name = "scalar-fastapi" },
{ name = "uvicorn" },
]
@@ -742,6 +753,7 @@ requires-dist = [
{ name = "httpx", specifier = ">=0.27.0" },
{ name = "rich", specifier = ">=13.0.0" },
{ name = "safetensors", specifier = ">=0.4.0" },
{ name = "scalar-fastapi", marker = "extra == 'server'", specifier = ">=1.6" },
{ name = "typer", specifier = ">=0.15.0" },
{ name = "uvicorn", marker = "extra == 'server'", specifier = ">=0.30" },
{ name = "websocket-client", specifier = ">=1.9.0" },
@@ -758,6 +770,7 @@ dev = [
{ name = "pytest-cov", specifier = ">=4.1" },
{ name = "respx", specifier = ">=0.22.0" },
{ name = "ruff", specifier = ">=0.9.0" },
{ name = "scalar-fastapi", specifier = ">=1.6" },
{ name = "uvicorn", specifier = ">=0.30" },
]