forked from ChelseaKR/queer-the-stacks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
157 lines (143 loc) · 5.71 KB
/
Copy pathpyproject.toml
File metadata and controls
157 lines (143 loc) · 5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "queer-the-stacks"
version = "0.1.0"
description = "A self-hosted, read-only reading dashboard + ethical recommender over your Calibre + KOReader stack."
readme = "README.md"
requires-python = ">=3.14"
license = { text = "AGPL-3.0-or-later" }
authors = [{ name = "Chelsea" }]
dependencies = [
"requests>=2.33",
]
[project.optional-dependencies]
app = [
"fastapi>=0.110",
"uvicorn>=0.27",
# starlette is a FastAPI transitive; floor raised above the fixed release so
# the resolver can never select a vulnerable build (installs are unpinned).
# PYSEC-2026-249 (fix 1.3.0) + PYSEC-2026-248 (fix 1.3.1) → require >=1.3.1.
"starlette>=1.3.1",
# Required by Starlette's Request.form() even for urlencoded bodies (the
# /login POST form) — Starlette asserts its presence at parse time.
"python-multipart>=0.0.9",
]
dev = [
"pytest>=8",
"pytest-cov>=5",
"ruff>=0.15",
"mypy>=1.18",
"types-requests",
"pip-audit>=2.7",
"httpx>=0.27", # FastAPI TestClient transport
# msgpack is a pip-audit→CacheControl transitive; floor raised above the
# fixed release. GHSA-6v7p-g79w-8964 → require >=1.2.1.
"msgpack>=1.2.1",
# Load-smoke gate (Quality §2, merge-blocking): tests/perf/locustfile.py,
# driven headlessly by scripts/perf-smoke.sh / `make perf-load`.
"locust>=2.29",
]
[project.scripts]
stacks = "ingest.cli:main"
[tool.setuptools]
packages = ["ingest", "recommender", "app"]
[tool.setuptools.package-data]
ingest = ["py.typed"]
recommender = ["py.typed"]
app = ["py.typed"]
# ---------------------------------------------------------------------------
# Lint / format gate (QUALITY-AND-METRICS-STANDARD §7, CI stage 1)
# ---------------------------------------------------------------------------
[tool.ruff]
line-length = 100
target-version = "py314"
src = ["ingest", "recommender", "app", "tests"]
[tool.ruff.lint]
# pycodestyle, pyflakes, isort, bugbear, comprehensions, pyupgrade, simplify,
# flake8-print (no stray prints), flake8-bandit (S) for a light SAST subset,
# mccabe (C90) for a cyclomatic-complexity gate.
select = ["E", "F", "I", "B", "C4", "UP", "SIM", "T20", "S", "C90"]
# S101: assert is allowed in tests (scoped per-file below).
# UP045/UP007: keep explicit `Optional[...]` for readability over `X | None`.
ignore = ["S101", "UP045", "UP007"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "S105", "S106", "S311", "S314"] # asserts, dummy secrets, demo RNG,
# stdlib XML parse of our own output
"ingest/cli.py" = ["T20"] # CLI prints to stdout by design
"app/build_static.py" = ["T20"] # build script prints its output path
# ---------------------------------------------------------------------------
# Type-check gate (CI stage 2) — strict.
# ---------------------------------------------------------------------------
[tool.mypy]
python_version = "3.14"
strict = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_any_generics = true
no_implicit_optional = true
warn_redundant_casts = true
warn_return_any = true
files = ["ingest", "recommender", "app"]
[[tool.mypy.overrides]]
# Third-party libs without stubs shipped here — don't fail strict on them.
module = ["fastapi.*"]
ignore_missing_imports = true
# ---------------------------------------------------------------------------
# Test + coverage gate (CI stage 3)
# Coverage is measured on everything a reader can reach: ingest + recommender +
# app, including the FastAPI wiring in app/server.py (exercised via TestClient
# in tests/test_auth.py and tests/test_server_lifecycle.py) and ingest/cli.py
# (exercised in tests/test_lists_cli.py, tests/test_cli_recommend.py, and
# tests/test_cli_export.py). Only app/build_static.py is omitted; see below.
# ---------------------------------------------------------------------------
[tool.pytest.ini_options]
addopts = [
"--strict-markers",
"--strict-config",
"--import-mode=importlib",
"--cov=ingest",
"--cov=recommender",
"--cov=app",
"--cov-branch",
"--cov-report=term-missing",
"--cov-report=xml:docs/audits/coverage.xml",
"--cov-fail-under=85",
"-ra",
]
testpaths = ["tests"]
filterwarnings = [
"error::DeprecationWarning:ingest.*",
"error::DeprecationWarning:recommender.*",
"error::DeprecationWarning:app.*",
# Upstream: starlette's TestClient now prefers the `httpx2` transport over
# `httpx`; unrelated to this project's code. Silence the noise.
"ignore:Using `httpx` with `starlette.testclient`",
]
[tool.coverage.run]
branch = true
omit = [
# Genuinely thin: 44 lines that render three documents to disk, and the
# a11y gate fails loudly if any of them stops being produced, which is a
# stronger check than a coverage percentage would be.
"app/build_static.py",
]
# ingest/cli.py used to be omitted here as "thin argparse glue". It is 503
# lines carrying real behaviour (refresh, doctor, import/export, list
# authoring), it already has three dedicated test files, and it measured 57%
# — the least-covered module in the project, sitting outside the denominator
# the 85% gate is computed from. Including it moves the reported total from
# ~96.9% to ~94.4%, still comfortably over the floor, and makes a CLI
# regression something the gate can actually see.
[tool.coverage.report]
# The genuinely untestable live-network glue is pragma-excluded at its class;
# parsers it feeds are unit-tested via fixtures.
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]