-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
241 lines (228 loc) · 6.28 KB
/
pyproject.toml
File metadata and controls
241 lines (228 loc) · 6.28 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
[project]
name = "swarmmind"
version = "0.1.1"
description = "AI Agent Team Operating System"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"fastapi>=0.115.0",
"uvicorn[standard]>=0.30.6",
"openai>=1.0.0",
"anthropic>=0.40.0",
"pydantic>=2.9.2",
"httpx>=0.27.2",
"pytest>=8.3.3",
"pytest-asyncio>=0.24.0",
"python-dotenv>=1.0.1",
"sqlmodel>=0.0.21",
"alembic>=1.13.0",
"litellm>=1.82.6",
"deerflow-harness @ git+https://github.com/hawkli-1994/deer-flow@main#subdirectory=backend/packages/harness",
"psycopg2-binary>=2.9.11",
]
[dependency-groups]
dev = [
"ruff>=0.6.0",
"mypy>=1.11.0",
"bandit>=1.7.9",
"pytest-cov>=5.0.0",
]
# ============================================
# Ruff - Python Linter & Formatter (Strict)
# ============================================
[tool.ruff]
target-version = "py312"
line-length = 120
indent-width = 4
[tool.ruff.lint]
select = [
# Pyflakes
"F",
# Pycodestyle
"E", "W",
# Pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# pydocstyle
"D",
# flake8-annotations
"ANN",
# flake8-bandit (security)
"S",
# flake8-comprehensions
"C4",
# flake8-debugger
"T10",
# flake8-eradicate
"ERA",
# mccabe (complexity)
"C90",
# pep8-naming
"N",
# flake8-return
"RET",
# flake8-unused-arguments
"ARG",
# pylint
"PL",
# Perflint
"PERF",
# Ruff-specific rules
"RUF",
]
ignore = [
# D104: Missing docstring in public package (too strict for __init__.py)
"D104",
# D107: Missing docstring in __init__ (too verbose for dataclasses)
"D107",
# ANN101: Missing type annotation for self
"ANN101",
# ANN102: Missing type annotation for cls
"ANN102",
# S101: Use of assert detected (pytest uses asserts)
"S101",
# RUF001/002/003: Ambiguous unicode character (Chinese project allows Chinese punctuation)
"RUF001", "RUF002", "RUF003",
# PLC0415: Import outside top-level (needed for lazy imports to avoid circular deps)
"PLC0415",
# ARG001/002: Unused arguments (common for API handlers and interfaces)
"ARG001", "ARG002",
# E501: Line too long (extended to 120 chars, remaining cases are acceptable)
"E501",
# UP042: Use StrEnum instead of str, Enum (str, Enum is valid in Python 3.12)
"UP042",
# S608: Possible SQL injection (using parameterized queries)
"S608",
# C901: Function too complex (legacy code, can be refactored later)
"C901",
# D205/D415: Docstring formatting issues (minor style issues)
"D205", "D415",
# ARG005: Unused lambda argument (common in callbacks)
"ARG005",
# ANN001/ANN201/ANN202: Missing type annotations (gradual typing)
"ANN001", "ANN201", "ANN202",
# N818: Exception name should end with Error (custom exception names are fine)
"N818",
# PLR2004: Magic value in comparison (common in config)
"PLR2004",
# E741: Ambiguous variable name (single letter variables in loops)
"E741",
# E402: Import not at top of file (needed for lazy imports)
"E402",
# ANN003: Missing type annotation for **kwargs
"ANN003",
# ANN002: Missing type annotation for *args
"ANN002",
# SIM102/SIM108: Use ternary operator (style preference)
"SIM102", "SIM108",
# PLR0911/0912/0915: Too many returns/branches/statements
"PLR0911", "PLR0912", "PLR0915",
# RUF012: Mutable class variables (Pydantic handles this)
"RUF012",
# RET504: Unnecessary assignment before return
"RET504",
# W291: Trailing whitespace (handled by formatter)
"W291",
# S110: try-except-pass (sometimes intentional)
"S110",
# B904: raise ... from (can be improved later)
"B904",
# UP028: Use yield from (can be refactored later)
"UP028",
# SIM105: Use contextlib.suppress (style preference)
"SIM105",
# RUF005: Use unpacking (style preference)
"RUF005",
# ANN401: Use of Any (needed for dynamic types)
"ANN401",
# S108: Use of /tmp (test file only)
"S108",
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.mccabe]
max-complexity = 10
[tool.ruff.lint.pylint]
max-args = 8
max-branches = 15
max-returns = 8
max-statements = 60
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "lf"
docstring-code-format = true
[tool.ruff.lint.per-file-ignores]
# Test files: allow missing docstrings, allow assert usage (handled above)
"tests/**/*.py" = ["D", "ANN", "PLR2004"]
# ============================================
# Mypy - Static Type Checker (Strict)
# ============================================
[tool.mypy]
python_version = "3.12"
strict = true
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_unreachable = true
show_error_codes = true
show_column_numbers = true
show_absolute_path = true
# ============================================
# Pytest & Coverage (Strict)
# ============================================
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"-v",
"--strict-markers",
"--tb=short",
"--cov=swarmmind",
"--cov-report=term-missing",
"--cov-report=html",
"--cov-fail-under=50",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks tests as integration tests",
"requires_llm: marks tests that require LLM configuration (deselect with '-m \"not requires_llm\"')",
]
[tool.coverage.run]
source = ["swarmmind"]
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
precision = 2
fail_under = 50
# ============================================
# Bandit - Security Linter
# ============================================
[tool.bandit]
exclude_dirs = ["tests"]
skips = ["B101"] # Skip assert check (handled by pytest)