forked from ChelseaKR/fare-policy-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
172 lines (159 loc) · 6.04 KB
/
Copy pathpyproject.toml
File metadata and controls
172 lines (159 loc) · 6.04 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
[project]
name = "fare-policy-assistant"
version = "0.1.0"
description = "Transit fare policy assistant with a public evaluation harness"
readme = "README.md"
license = "Apache-2.0"
license-files = ["LICENSE", "NOTICE"]
authors = [{ name = "Chelsea Kelly-Reif" }]
requires-python = ">=3.12"
dependencies = [
"anthropic[bedrock]>=0.100",
"beautifulsoup4>=4.12",
"httpx>=0.27",
"jsonschema>=4.20",
"pyyaml>=6.0",
"rank-bm25>=0.2.2",
]
[project.optional-dependencies]
dense = [
"sentence-transformers>=3.0",
]
# PDF policy ingest (ADR 0008). Text-layer extraction only; the OCR fallback
# additionally needs the tesseract and poppler system binaries.
pdf = [
"pypdf>=4.0",
]
ocr = [
"pypdf>=4.0",
"pytesseract>=0.3.10",
"pdf2image>=1.17",
]
[dependency-groups]
dev = [
"pytest>=8.0",
"pytest-cov>=5.0",
"ruff>=0.15",
"mypy>=1.18",
"types-pyyaml",
"pypdf>=4.0",
"babel>=2.16",
]
# Advisory mutation testing (backlog #15). Isolated in its own group so the
# default `make check` / CI install stays lean; installed only for `make
# mutation` (and the manual weekly workflow). See docs/mutation-testing.md.
mutation = [
"mutmut>=3.3,<4",
]
[tool.ruff]
line-length = 100
target-version = "py312"
# Immutable vendored standards code is linted/formatted at its source commit.
# Excluding it here prevents this repo's pinned Ruff version/config from
# rewriting reviewed bytes while first-party code remains fully gated.
extend-exclude = ["src/assistant/_vendor"]
[tool.ruff.lint]
# CQ-04/CQ-05: C90 (mccabe complexity) is on, gated at the standard's
# max-complexity = 10. The per-file-ignores below are today's debt, not a
# blanket exemption — see issue #137 and CHANGELOG for the retirement plan.
select = ["E", "F", "I", "UP", "B", "C90"]
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.per-file-ignores]
# CQ-05 debt ceiling, frozen at the count measured in issue #137 (2026-08-15)
# plus normal drift since. Retire file by file rather than widen; a file
# dropped from this list must stay off it. `evals/runner.py::_run_resolved`
# (49) is the single biggest offender and is called out in #137 as worth
# doing on its own, carefully, since eval-run correctness rests on it.
"evals/runner.py" = ["C901"]
"tests/test_promotion_evidence.py" = ["C901"]
"src/assistant/promotion_evidence.py" = ["C901"]
"src/assistant/release_identity.py" = ["C901"]
"src/assistant/gtfs.py" = ["C901"]
"web/handler.py" = ["C901"]
"web/console.py" = ["C901"]
"src/assistant/snapshots.py" = ["C901"]
"src/assistant/identity.py" = ["C901"]
"src/assistant/corpus.py" = ["C901"]
"evals/attestation.py" = ["C901"]
"web/a11y.py" = ["C901"]
"tests/test_build_evidence_site.py" = ["C901"]
"src/assistant/i18n.py" = ["C901"]
"evals/spanish_quality.py" = ["C901"]
"evals/report.py" = ["C901"]
"evals/plumbline_guard.py" = ["C901"]
"evals/plumbline_export.py" = ["C901"]
"evals/judges.py" = ["C901"]
"evals/history.py" = ["C901"]
"evals/checks.py" = ["C901"]
"evals/calibration.py" = ["C901"]
[tool.mypy]
python_version = "3.12"
strict = false
check_untyped_defs = true
ignore_missing_imports = true
[tool.pytest.ini_options]
testpaths = ["tests"]
# evals/ is a repo-root package (it is the product, not a library to install).
pythonpath = ["."]
# CQ-07: catch typo'd marks and ini options, and use the importlib import mode
# (no sys.path/rootdir mutation, no __init__.py requirement ambiguity) rather
# than pytest's legacy implicit-namespace-package import.
addopts = "--strict-markers --strict-config --import-mode=importlib"
[tool.mutmut]
# Advisory mutation testing (backlog #15). Scoped to the two correctness-critical
# scoring modules whose bugs would silently corrupt a score or let a bad answer
# pass: the deterministic per-case gate (checks.py) and the LLM-as-judge verdict
# parsing (judges.py). The cross-domain safety guards (no-determination /
# citation / PII in src/assistant/guards.py) are exercised transitively but are
# not the mutation target here. Run with `make mutation`; never a per-PR merge
# gate. See docs/mutation-testing.md for the baseline and how to read survivors.
source_paths = [
"evals/checks.py",
"evals/judges.py",
]
# mutmut copies source_paths into a mutants/ sandbox and strips the originals
# (`.`, `src/`, `source/`) from sys.path so the tests import the mutated copy.
# The target modules import the assistant package (src/assistant) and live in
# the evals package, so both must be copied into the sandbox too, or the tests
# fail to import at all. evals/__init__.py makes mutants/evals an importable
# package; src carries the unmutated assistant code the targets depend on.
also_copy = [
"src",
"evals/__init__.py",
"prompts",
]
# Only the two fast, offline unit suites that exercise the target modules. No
# network, no model calls, no coverage gate — this keeps each mutant cheap so the
# bounded run finishes in well under a minute.
pytest_add_cli_args_test_selection = [
"tests/test_checks.py",
"tests/test_judges.py",
]
[tool.coverage.run]
branch = true
# The three first-party packages: the assistant pipeline (src/assistant), the
# eval harness (evals/), and the demo web layer (web/). Optional integrations
# (dense retrieval, OCR) need extras not installed in CI, so the lines that load
# them stay uncovered honestly rather than being mocked into a green number.
source = ["assistant", "web", "evals"]
# Vendored standards code is verified at its immutable source boundary and is
# not first-party Fare code. Do not dilute this repository's coverage signal
# with a copied dependency.
omit = ["*/_vendor/*"]
[tool.coverage.report]
# Same floor the Makefile/CI gate enforces via --cov-fail-under=$(COV_MIN).
# Measured 91.60% branch coverage on 2026-07-16; honest achieved is ~92-95%,
# the gate sits a few points below to absorb environment drift.
fail_under = 90
show_missing = true
exclude_lines = [
"pragma: no cover",
"if __name__ == .__main__.:",
"raise NotImplementedError",
]
[tool.setuptools.packages.find]
where = ["src"]
[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"