Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

4.4 KB
Raw Blame
[project]
name = "securo-backend"
version = "0.16.6"
description = "Securo API - Personal Finance Manager"
requires-python = ">=3.11"
# These ranges express intent; the resolved versions live in uv.lock, which is
# what CI and the Docker image actually install (exported with --frozen and
# fed to pip with hash checking). After changing anything here, run
# scripts/lock.sh and commit the updated uv.lock — CI fails if it drifts.
dependencies = [
    "fastapi>=0.109.0",
    "uvicorn[standard]>=0.27.0",
    "sqlalchemy>=2.0.0",
    "alembic>=1.13.0",
    "asyncpg>=0.29.0",
    "pydantic>=2.5.0",
    "pydantic-settings>=2.5.0",
    "python-jose[cryptography]>=3.3.0",
    "cryptography==46.0.7",
    "passlib[bcrypt]>=1.7.4",
    "fastapi-users[sqlalchemy]>=13.0.0",
    "httpx>=0.26.0",
    "python-multipart>=0.0.6",
    "ofxparse>=0.21",
    "celery[redis]>=5.3.0",
    "aiofiles>=24.0",
    "redis[hiredis]>=5.0.0",
    "pyotp>=2.9.0",
    "webauthn>=2.8.0",
    "yfinance>=1.3.0",
    "pgvector>=0.3.0",
    "pypdf>=5.0.0",
    # Invoice PDF rendering. ReportLab rather than an HTML-to-PDF engine on
    # purpose: WeasyPrint and its peers need pango, cairo and gdk-pixbuf in
    # the image, and this is a self-hosted product where every megabyte and
    # every native library is paid for by the person running it. ReportLab
    # ships pure-Python wheels, and Pillow (already present) covers the logo.
    "reportlab>=4.2.0",
    # Password-protected backups. The stdlib zipfile can only *read* the
    # legacy ZipCrypto scheme and cannot write an encrypted archive at all,
    # so AES-256 zips need this fork of it.
    "pyzipper>=0.4.0",
    # Bundled multilingual embedder — only imported on demand by the
    # agents knowledge-base path. ONNX runtime, ~120 MB model downloaded
    # on first use to /app/data/embedding_models. Users not on the
    # agents feature pay zero cost (the package is installed but never
    # imported).
    "fastembed>=0.4.0",
    # Resolve the host's IANA timezone when no app setting or TZ override exists.
    "tzlocal>=5.0.0",
]

[project.optional-dependencies]
dev = [
    "pytest>=9.0.0",
    "pytest-asyncio>=1.0",
    "pytest-cov>=4.1.0",
    "pytest-xdist>=3.6.1",
    "httpx>=0.26.0",
    "aiosqlite>=0.19.0",
    # Upper-bounded so CI lint stays deterministic: ruff 0.16 reformats the
    # historical alembic/ migration import blocks. Bump deliberately (with the
    # accompanying reformat) rather than letting CI float to a newer release.
    "ruff>=0.17,<0.18",
    # Pinned exactly, for the same reason as ruff above: ty is pre-1.0 and each
    # 0.0.x release can add new checks, so letting it float would turn a green
    # CI red on an unrelated PR. Bump deliberately, together with whatever
    # annotations the new release asks for.
    "ty==0.0.86",
]

[tool.setuptools.packages.find]
include = ["app*"]

[tool.setuptools.package-data]
# Ship the category taxonomy in wheels/non-editable installs; without this it
# only exists in editable (-e) installs and the backend crashes at import.
app = ["data/*.json"]

[tool.pytest.ini_options]
# Fail on configuration/marker typos, duplicate parameter IDs and unexpected
# xfail passes instead of silently weakening the suite.
strict = true
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
asyncio_default_test_loop_scope = "session"
testpaths = ["tests"]

[tool.coverage.run]
# FastAPI/Starlette route handlers run on SQLAlchemy's greenlet, so coverage.py
# must track greenlet (and thread) execution contexts — otherwise async endpoint
# bodies execute but their lines are never attributed, under-reporting every API module.
concurrency = ["greenlet", "thread"]
omit = [
    "app/cli.py",
    "app/worker.py",
    "app/tasks/*",
    "app/providers/pluggy.py",
    "app/providers/enable_banking.py",
    "app/providers/simplefin.py",
    "app/providers/market_price.py",
]

[tool.ty.environment]
# Match ruff's target-version: check against the oldest Python we support, so a
# 3.12+-only construct is caught here rather than by a self-hoster on 3.11.
python-version = "3.11"

[tool.ty.rules]
unused-ignore-comment = "error"

[tool.ruff]
line-length = 100
target-version = "py311"

[tool.ruff.lint]
# Ruff 0.16 widened its default rule set, so leaving the selection implicit
# means a ruff bump silently changes what CI enforces. Pin the set we lint
# against (ruff's pre-0.16 default) and change it deliberately, not by upgrade.
select = ["E4", "E7", "E9", "F"]
ignore = ["E711", "E712"]