-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathpyproject.toml
More file actions
223 lines (201 loc) · 7.11 KB
/
pyproject.toml
File metadata and controls
223 lines (201 loc) · 7.11 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
222
223
[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 = [
"requests",
"arxiv",
"pyyaml",
"numpy>=2.2.4",
"openai>=1.68.2",
"openai-agents>=0.14",
"pillow>=10.1.0,<11.0.0",
"llama-cloud-services>=0.6.12",
"ipykernel>=6.29.5",
"pydantic>=2.0.0",
"pymupdf>=1.23.0",
"marker>=2.1.3",
"python-dotenv>=1.0.0",
"httpx[socks]>=0.28.1",
"litellm>=1.74.0.post1",
"jinja2>=3.0.0",
]
[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",
"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
# ----------------------------------------------------------------------------
# Strategy: explicit include-list of files that survive PR3-PR5 plus the
# target-architecture module dirs (knowledge/, configs/, preprocess/, flows/,
# mind/). Transitional modules (config/, flow/, llm/, models/{analysis,
# content,paper}.py, parsers/, sources/, utils/tmp.py) are NOT included; they
# get deleted in subsequent PRs and are not worth modernizing for type checks.
[tool.basedpyright]
include = ["quantmind"]
# Transitional modules excluded from type checking — they get deleted in
# PR3-PR5 (per CLAUDE.md "Current Repository State" table). New modules
# (knowledge/, configs/, preprocess/, flows/, mind/, magic.py) automatically
# get type-checked at "standard" mode as they land — no further config needed.
exclude = [
"**/__pycache__",
"**/.venv",
"**/build",
"quantmind/config",
"quantmind/flow",
"quantmind/llm",
"quantmind/parsers",
"quantmind/sources",
"quantmind/models/analysis.py",
"quantmind/models/content.py",
"quantmind/models/paper.py",
"quantmind/utils/tmp.py",
]
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 is a permanent leaf. As new modules
# land (knowledge, preprocess, configs, flows, mind), additional contracts
# will be added (knowledge is a leaf; preprocess depends on knowledge+utils;
# flows is the apex; mind depends on knowledge+utils only).
[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.config",
"quantmind.configs",
"quantmind.flow",
"quantmind.knowledge",
"quantmind.llm",
"quantmind.models",
"quantmind.parsers",
"quantmind.sources",
]
[[tool.importlinter.contracts]]
name = "knowledge is a leaf (no inbound deps from quantmind packages)"
type = "forbidden"
source_modules = ["quantmind.knowledge"]
forbidden_modules = [
"quantmind.config",
"quantmind.configs",
"quantmind.flow",
"quantmind.llm",
"quantmind.models",
"quantmind.parsers",
"quantmind.sources",
"quantmind.utils",
]
[[tool.importlinter.contracts]]
name = "configs only depends on knowledge (transitional modules forbidden)"
type = "forbidden"
source_modules = ["quantmind.configs"]
forbidden_modules = [
"quantmind.config",
"quantmind.flow",
"quantmind.llm",
"quantmind.models",
"quantmind.parsers",
"quantmind.sources",
]
# ----------------------------------------------------------------------------
# pytest: configuration + coverage gate
# ----------------------------------------------------------------------------
[tool.pytest.ini_options]
testpaths = ["tests"]
# Coverage floor 60% accommodates branch-coverage on transitional modules
# (pdf_parser.py 26%, tmp.py 20%, arxiv_source.py 57%) that get deleted in
# PR3-PR5. Ratchet to 70% once they're gone, then 80% for the post-pivot
# codebase.
addopts = [
"--cov=quantmind",
"--cov-report=term-missing",
"--cov-fail-under=60",
"-ra",
]
filterwarnings = [
# Pydantic v1 → v2 transition warnings on transitional model code that
# gets removed in PR3. Suppress until those modules are gone.
"ignore::DeprecationWarning:pydantic.*",
"ignore::pydantic.PydanticDeprecatedSince20",
]
[tool.coverage.run]
source = ["quantmind"]
branch = true
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
# Coverage floor starts at 60% (branch-coverage drops the line-only baseline
# from 69% to ~65%). Ratchet to 70% in PR3 once analysis.py / podcast_flow.py
# / summary_flow.py / tmp.py and the rest of the transitional modules are
# deleted.