feat: migrate backend to uv package manager

Replace pip + requirements.txt with uv for dependency management.

- Multi-stage Dockerfile using ghcr.io/astral-sh/uv builder image
- CI updated to use astral-sh/setup-uv@v4
- Ruff config moved to [tool.ruff.lint] (fixes deprecation)
- Transitive deps removed, missing direct deps added (requests, PySocks, urllib3)
- Database layer migrated to async (AsyncSession + aiosqlite)
- Tests updated to match async database interface

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
EstrellaXD
2026-01-23 12:56:23 +01:00
parent bfba010471
commit 9c5474d8e9
15 changed files with 2270 additions and 422 deletions

View File

@@ -4,109 +4,61 @@ version = "3.1.0"
description = "AutoBangumi - Automated anime download manager"
requires-python = ">=3.10"
dependencies = [
"anyio>=4.0.0",
"beautifulsoup4>=4.12.0",
"certifi>=2023.5.7",
"charset-normalizer>=3.1.0",
"click>=8.1.3",
"fastapi>=0.109.0",
"h11>=0.14.0",
"idna>=3.4",
"pydantic>=2.0.0",
"sniffio>=1.3.0",
"soupsieve>=2.4.1",
"typing_extensions>=4.0.0",
"urllib3>=2.0.3",
"uvicorn>=0.27.0",
"Jinja2>=3.1.2",
"python-dotenv>=1.0.0",
"httpx>=0.25.0",
"httpx-socks>=0.9.0",
"beautifulsoup4>=4.12.0",
"sqlmodel>=0.0.14",
"sqlalchemy[asyncio]>=2.0.0",
"aiosqlite>=0.19.0",
"pydantic>=2.0.0",
"python-jose>=3.3.0",
"passlib>=1.7.4",
"bcrypt>=4.0.1,<4.1",
"python-multipart>=0.0.6",
"sqlmodel>=0.0.14",
"sse-starlette>=1.6.5",
"semver>=3.0.1",
"python-dotenv>=1.0.0",
"Jinja2>=3.1.2",
"openai>=1.54.3",
"httpx>=0.25.0",
"httpx-socks>=0.9.0",
"aiosqlite>=0.19.0",
"sqlalchemy[asyncio]>=2.0.0",
"semver>=3.0.1",
"sse-starlette>=1.6.5",
"webauthn>=2.0.0",
"urllib3>=2.0.3",
"requests>=2.31.0",
"PySocks>=1.7.1",
]
[project.optional-dependencies]
[dependency-groups]
dev = [
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"ruff>=0.1.0",
"black>=24.0.0",
"pre-commit>=3.0.0",
]
[tool.pytest.ini_options]
testpaths = ["src/test"]
pythonpath = ["src"]
asyncio_mode = "auto"
[tool.ruff]
select = [
# pycodestyle(E): https://beta.ruff.rs/docs/rules/#pycodestyle-e-w
"E",
# Pyflakes(F): https://beta.ruff.rs/docs/rules/#pyflakes-f
"F",
# isort(I): https://beta.ruff.rs/docs/rules/#isort-i
"I"
]
ignore = [
# E501: https://beta.ruff.rs/docs/rules/line-too-long/
'E501',
# F401: https://beta.ruff.rs/docs/rules/unused-import/
# avoid unused imports lint in `__init__.py`
'F401',
]
line-length = 88
target-version = "py310"
exclude = [".venv", "venv", "build", "dist"]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
[tool.ruff.lint]
select = ["E", "F", "I"]
ignore = ["E501", "F401"]
fixable = ["ALL"]
unfixable = []
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
per-file-ignores = {}
# Same as Black.
line-length = 88
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Assume Python 3.10.
target-version = "py310"
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.uv]
package = false
[tool.black]
line-length = 88
target-version = ['py310', 'py311']