-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathpyproject.toml
More file actions
221 lines (197 loc) · 6.63 KB
/
Copy pathpyproject.toml
File metadata and controls
221 lines (197 loc) · 6.63 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "quantmind"
version = "0.2.0"
description = "QuantMind - Intelligent Knowledge Extraction and Retrieval Framework"
requires-python = ">=3.10"
dependencies = [
"arxiv",
"pyyaml",
"numpy>=2.2.4",
"openai>=1.68.2",
"openai-agents>=0.14",
"pillow>=10.1.0,<11.0.0",
"ipykernel>=6.29.5",
"pydantic>=2.0.0",
"pymupdf>=1.23.0",
"python-dotenv>=1.0.0",
"httpx[socks]>=0.28.1",
"litellm>=1.74.0.post1",
"jinja2>=3.0.0",
"trafilatura>=1.10",
]
[project.optional-dependencies]
# Dev tooling that backs scripts/verify.sh: ruff (format+lint), basedpyright
# (type check), import-linter (architecture contracts), pytest+pytest-cov
# (tests + coverage floor). Black/isort/mypy from the previous toolchain are
# intentionally dropped — ruff and basedpyright supersede them.
dev = [
"ruff>=0.11,<0.12",
"basedpyright>=1.39",
"import-linter>=2.11",
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"pytest-asyncio>=0.23",
"respx>=0.21",
"pre-commit>=3.0",
]
full = [
"marker-pdf>=0.2.0",
"beautifulsoup4>=4.12.0",
"sentence-transformers>=2.2.0",
]
[tool.setuptools.packages.find]
where = ["."]
include = ["quantmind*"]
[tool.setuptools.package-data]
"*" = ["*.yaml", "*.yml", "*.json", "*.txt"]
[[tool.uv.index]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
default = true
# ----------------------------------------------------------------------------
# ruff: format + lint
# ----------------------------------------------------------------------------
[tool.ruff]
line-length = 80
target-version = "py310"
[tool.ruff.lint]
# Layered rule selection. D (docstrings) keeps the existing convention;
# F (pyflakes) catches real bugs; I (isort) keeps imports tidy; E/W
# (pycodestyle, minus E501 which ruff format already handles); B (bugbear)
# catches subtle correctness issues.
select = ["D", "E", "F", "I", "W", "B", "W505"]
ignore = [
# Docstring rules we explicitly waive (see existing convention).
"D100", "D102", "D104", "D105", "D107", "D203", "D213", "D401", "D402",
# E501 (line-too-long) is handled by ruff format; flagging it again on
# long URLs / strings only adds noise.
"E501",
]
[tool.ruff.lint.per-file-ignores]
# Tests don't need module/function docstrings or strict bugbear rules.
"tests/**/*.py" = ["D", "B"]
"**/__init__.py" = ["D104", "F401"]
[tool.ruff.lint.pycodestyle]
max-doc-length = 100
[tool.ruff.lint.pydocstyle]
convention = "google"
# ----------------------------------------------------------------------------
# basedpyright: type checker
# ----------------------------------------------------------------------------
# Every module in `quantmind/` is type-checked at "standard" mode. PR5
# deleted the transitional packages (`config/`, `flow/`, `llm/`,
# `models/`) so the exclude list is now down to the directories pyright
# always wants ignored.
[tool.basedpyright]
include = ["quantmind"]
exclude = [
"**/__pycache__",
"**/.venv",
"**/build",
]
pythonVersion = "3.10"
typeCheckingMode = "standard"
reportMissingImports = "error"
reportMissingTypeStubs = "none"
# Pydantic v2 discriminated unions tighten a `str` field to `Literal["..."]`
# in subclasses (e.g. `Paper.item_type: Literal["paper"]`). Python's variance
# rules say mutable attributes must be invariant, so basedpyright flags this
# even though Pydantic supports it. We use this idiom throughout knowledge/
# and configs/, so disable the diagnostic globally.
reportIncompatibleVariableOverride = "none"
# ----------------------------------------------------------------------------
# import-linter: architectural boundary contracts
# ----------------------------------------------------------------------------
# Encodes the target architecture: utils, knowledge, and preprocess are
# leaves; configs depends only on knowledge; flows + magic is the apex
# layer (PR5). The transitional packages (config/, flow/, llm/, models/)
# were deleted in PR5; they remain in the forbidden lists as a tripwire
# against accidental re-introduction during future refactors.
[tool.importlinter]
root_packages = ["quantmind"]
[[tool.importlinter.contracts]]
name = "utils is a leaf (no inbound deps from quantmind packages)"
type = "forbidden"
source_modules = ["quantmind.utils"]
forbidden_modules = [
"quantmind.configs",
"quantmind.flows",
"quantmind.knowledge",
"quantmind.magic",
"quantmind.preprocess",
]
[[tool.importlinter.contracts]]
name = "knowledge is a leaf (no inbound deps from quantmind packages)"
type = "forbidden"
source_modules = ["quantmind.knowledge"]
forbidden_modules = [
"quantmind.configs",
"quantmind.flows",
"quantmind.magic",
"quantmind.preprocess",
"quantmind.utils",
]
[[tool.importlinter.contracts]]
name = "configs only depends on knowledge"
type = "forbidden"
source_modules = ["quantmind.configs"]
forbidden_modules = [
"quantmind.flows",
"quantmind.magic",
"quantmind.preprocess",
]
[[tool.importlinter.contracts]]
name = "preprocess only depends on utils (no inbound deps on configs/knowledge/flows)"
type = "forbidden"
source_modules = ["quantmind.preprocess"]
forbidden_modules = [
"quantmind.configs",
"quantmind.flows",
"quantmind.knowledge",
"quantmind.magic",
]
[[tool.importlinter.contracts]]
name = "flows + magic is apex (no transitional package imports)"
type = "forbidden"
source_modules = [
"quantmind.flows",
"quantmind.magic",
]
# These packages were deleted in PR5; the contract guards against any
# future code re-introducing them under the same names.
forbidden_modules = [
"quantmind.config",
"quantmind.flow",
"quantmind.llm",
"quantmind.models",
]
# ----------------------------------------------------------------------------
# pytest: configuration + coverage gate
# ----------------------------------------------------------------------------
[tool.pytest.ini_options]
testpaths = ["tests"]
# Coverage floor 75% — PR5 deleted the transitional packages so every
# remaining module is in the target architecture and is well-tested.
addopts = [
"--cov=quantmind",
"--cov-report=term-missing",
"--cov-fail-under=75",
"-ra",
]
asyncio_mode = "auto"
[tool.coverage.run]
source = ["quantmind"]
branch = true
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
# Branch coverage. Floor moves with the migration:
# PR3: 60% (parsers/sources still drag the average down)
# PR4: 65% (parsers/sources gone; preprocess >85%)
# PR5: 75% (flow/, llm/, config/, transitional models/ gone)