Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
174 lines (157 loc) · 6.07 KB
/
Copy pathpyproject.toml
File metadata and controls
174 lines (157 loc) · 6.07 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
[project]
name = "everalgo-workspace"
version = "0"
description = "EverAlgo monorepo workspace — algorithm library for memory extraction & ranking."
requires-python = ">=3.12"
[tool.uv]
package = false
[tool.uv.workspace]
members = ["packages/*", "benchmarks"]
[tool.uv.sources]
everalgo-core = { workspace = true }
everalgo-boundary = { workspace = true }
everalgo-clustering = { workspace = true }
everalgo-rank = { workspace = true }
everalgo-parser = { workspace = true }
everalgo-user-memory = { workspace = true }
everalgo-agent-memory = { workspace = true }
everalgo-knowledge = { workspace = true }
everalgo-benchmarks = { workspace = true }
[dependency-groups]
dev = [
"everalgo-core",
"everalgo-boundary",
"everalgo-clustering",
"everalgo-rank",
"everalgo-parser",
"everalgo-user-memory",
"everalgo-agent-memory",
"everalgo-knowledge",
"everalgo-benchmarks",
"pytest>=8.0",
"pytest-asyncio>=0.23",
"respx>=0.21",
"ruff>=0.8",
"mypy>=1.10",
"pre-commit>=4.0",
"git-cliff>=2.6",
"pytest-cov>=7.1.0",
"pytest-xdist>=3.8.0",
"diff-cover>=10.2.0",
"pyright==1.1.409",
]
[tool.ruff]
line-length = 120
extend-exclude = ["opensource"]
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint]
select = [
"F", "E", "W",
"I", "D", "UP",
"B", "SIM", "C4", "C90", "PIE",
"N", "TC", "PERF",
"A", "FBT",
"G", "LOG", "TRY",
"RUF",
]
ignore = [
"D100",
"D104",
"D105",
"D107",
"E501",
"TRY003", # numpy-style detailed exception messages — see ADR-013
]
[tool.ruff.lint.isort]
known-first-party = ["everalgo", "tests"]
[tool.ruff.lint.per-file-ignores]
"**/tests/**/*.py" = ["D101", "D102", "D103", "D401"]
# Prompts are verbatim opensource ports — keep byte-equivalence: opensource files mix full-width / ASCII
# punctuation (RUF001 / RUF002), retain trailing whitespace + whitespace-only blank lines inside prompt
# strings (W291 / W293), and use ``{{ }}`` braces in template examples.
"**/prompts/zh/**/*.py" = ["RUF001", "RUF002", "W291", "W293"]
"**/prompts/en/**/*.py" = ["RUF001", "RUF002", "W291", "W293", "D205"]
"benchmarks/datasets/*/prompts.py" = ["RUF001", "RUF002", "W291", "W293", "E501"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests", "packages"]
# `importlib` import-mode is required for PEP 420 namespace packages and prevents
# test subdirectories like `types/` from shadowing stdlib modules.
# https://docs.pytest.org/en/stable/explanation/pythonpath.html
addopts = "-ra --import-mode=importlib"
markers = [
"integration: real-network / real-LLM tests; gated by env vars (e.g. OPENROUTER_API_KEY)",
]
[tool.pyright]
typeCheckingMode = "strict"
pythonVersion = "3.12"
venvPath = "."
venv = ".venv"
# Tests are intentionally excluded from pyright: mock / lambda / dynamic stub patterns common in pytest
# fixtures defeat strict inference. mypy still type-checks the tests with the relaxed `tests.*` override
# (see `[[tool.mypy.overrides]]` below) — runtime type errors in tests will surface there or in pytest.
include = ["packages/*/src"]
exclude = ["opensource", "**/__pycache__", ".venv", "**/tests/**"]
# pyright's equivalent of mypy's `mypy_path` — required for PEP 420 namespace resolution across the 8 dists.
extraPaths = [
"packages/everalgo-core/src",
"packages/everalgo-boundary/src",
"packages/everalgo-clustering/src",
"packages/everalgo-rank/src",
"packages/everalgo-parser/src",
"packages/everalgo-user-memory/src",
"packages/everalgo-agent-memory/src",
"packages/everalgo-knowledge/src",
]
reportImplicitOverride = true
reportOverlappingOverload = false
reportImportCycles = false
reportPrivateUsage = false
[tool.mypy]
python_version = "3.12"
strict = true
namespace_packages = true
explicit_package_bases = true
# Pyright runs over the same tree, so some `# type: ignore` lines are pyright-only and look unused to mypy.
warn_unused_ignores = false
# Vendored opensource reference code (locomo-benchmark / the upstream system) is checked into the repo for algorithm
# porting; it is not part of the published distributions and must not block the workspace's strict gate.
# `local/` is gitignored scratch space for design notes and one-off probe scripts (see `.gitignore`), so nothing
# in it is repository content. pyright already skips it by virtue of `include = ["packages/*/src"]`; mypy scanned
# it, which meant dropping a throwaway script there broke the gate for everyone.
exclude = "^(opensource|local)/"
# Required for PEP 420 namespace resolution; also disambiguates `everalgo.types` from stdlib `types`.
mypy_path = "packages/everalgo-core/src:packages/everalgo-boundary/src:packages/everalgo-clustering/src:packages/everalgo-rank/src:packages/everalgo-parser/src:packages/everalgo-user-memory/src:packages/everalgo-agent-memory/src:packages/everalgo-knowledge/src"
# `tests.*` covers the top-level `tests/` tree; `*.tests.*` covers nested test packages such as
# `benchmarks.tests.*` and `everalgo-<dist>.tests.*` (mypy module-spec wildcards match a single
# path segment per `*`).
[[tool.mypy.overrides]]
module = ["tests.*", "*.tests.*"]
disallow_untyped_defs = false
disallow_untyped_calls = false
disallow_incomplete_defs = false
# tqdm ships no type stubs and we don't take the `types-tqdm` dep just to silence one import line.
[[tool.mypy.overrides]]
module = ["tqdm.*"]
ignore_missing_imports = true
[tool.coverage.run]
branch = true
source = ["everalgo"]
[tool.coverage.report]
# Single source of truth for coverage gating (CI passes no --cov-fail-under; it reads this).
# `exclude_also` *adds* to coverage.py's built-in defaults; the pattern set is the recommended example
# from the coverage.py docs — unreachable / untestable lines (defensive raises, abstract methods,
# TYPE_CHECKING-only imports, Protocol bodies) are excluded so the percentage reflects code that
# should be tested, not stubs masquerading as covered. https://coverage.readthedocs.io/en/latest/excluding.html
exclude_also = [
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]
fail_under = 90