From 13eaa35f1c9ddc3d4d2810760dec12f4698b5411 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 14 May 2026 07:31:39 -0400 Subject: [PATCH] feat: scaffold backend Python project (Quart + SQLAlchemy + Celery deps) Pins runtime and ML deps separately so the regular web image stays lean. Configures ruff for py312 with bugbear, async, and pyupgrade lints enabled. psycopg sync driver included up-front for alembic. Co-Authored-By: Claude Opus 4.7 (1M context) --- backend/__init__.py | 0 backend/app/__init__.py | 0 pyproject.toml | 9 +++++++++ requirements-ml.txt | 9 +++++++++ requirements.txt | 28 ++++++++++++++++++++++++++++ ruff.toml | 23 +++++++++++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 backend/__init__.py create mode 100644 backend/app/__init__.py create mode 100644 pyproject.toml create mode 100644 requirements-ml.txt create mode 100644 requirements.txt create mode 100644 ruff.toml diff --git a/backend/__init__.py b/backend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/app/__init__.py b/backend/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3ff350f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,9 @@ +[project] +name = "fabledcurator" +version = "0.1.0" +description = "FabledSword family — self-hosted media curation, gallery, ML tagging, and subscription-driven downloads." +requires-python = ">=3.12" + +[tool.setuptools.packages.find] +where = ["."] +include = ["backend*"] diff --git a/requirements-ml.txt b/requirements-ml.txt new file mode 100644 index 0000000..826fdd0 --- /dev/null +++ b/requirements-ml.txt @@ -0,0 +1,9 @@ +-r requirements.txt + +# ML stack +torch>=2.2,<2.3 +torchvision>=0.17,<0.18 +transformers>=4.40,<4.41 +onnxruntime>=1.17,<1.18 +huggingface-hub>=0.22,<0.23 +opencv-python-headless>=4.9,<5.0 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ada374b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,28 @@ +# Web +quart>=0.19,<0.20 +hypercorn>=0.16,<0.17 + +# DB +sqlalchemy[asyncio]>=2.0,<2.1 +asyncpg>=0.29,<0.30 +psycopg[binary]>=3.1,<3.2 +alembic>=1.13,<1.14 +pgvector>=0.2,<0.3 + +# Task queue +celery>=5.4,<5.5 +redis>=5.0,<6.0 + +# Crypto for credential storage (lands in FC-3, but pinned now for stability) +cryptography>=42,<43 + +# Image handling (lands in FC-2) +pillow>=10.2,<11.0 +imagehash>=4.3,<4.4 + +# Gallery-dl wrapper (lands in FC-3) +gallery-dl>=1.27,<1.28 + +# Utilities +python-dotenv>=1.0,<2.0 +structlog>=24.1,<25.0 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..f71eae8 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,23 @@ +target-version = "py312" +line-length = 100 + +[lint] +select = [ + "E", "W", # pycodestyle + "F", # pyflakes + "I", # isort + "UP", # pyupgrade + "B", # flake8-bugbear + "C4", # comprehensions + "ASYNC", # async correctness +] +ignore = [ + "E501", # line length, handled by formatter +] + +[lint.per-file-ignores] +"alembic/versions/*.py" = ["E", "F", "I", "UP"] +"tests/*" = ["F401"] + +[format] +quote-style = "double"