-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
256 lines (221 loc) · 5.91 KB
/
Copy pathpyproject.toml
File metadata and controls
256 lines (221 loc) · 5.91 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
[project]
name = "mcp-context-server"
version = "0.4.1"
description = "MCP Context Server — a FastMCP-based server providing persistent multimodal context storage for LLM agents."
readme = "README.md"
authors = [{ name = "Aleksandr Filippov", email = "alexfeel@protonmail.com" }]
requires-python = ">=3.12,<3.13"
dependencies = [
"fastmcp==2.12.4",
"pydantic-settings==2.11.0",
"pydantic==2.11.10",
"python-dotenv==1.1.1",
"typing_extensions==4.15.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project.scripts]
mcp-context-server = "app.server:main"
mcp-context = "app.server:main"
[tool.hatch.build.targets.wheel]
packages = ["app"]
[tool.uv]
package = true
[project.optional-dependencies]
semantic-search = [
"ollama>=0.4.0",
"numpy>=1.24.0",
"sqlite-vec>=0.1.6",
]
[dependency-groups]
dev = [
"pre-commit",
"pytest-asyncio>=1.0.0",
"pytest-cov>=6.1.1",
"pytest>=8.3.5",
"hatchling>=1.27.0",
"mypy>=1.18.2",
"pyright>=1.1.406",
"pytest-timeout>=2.4.0",
]
[tool.ruff]
# Enable preview features
preview = true
# General settings
src = ["app"]
target-version = "py312"
line-length = 127
extend-include = ["tests/*"]
[tool.ruff.lint]
# Ignore specific rules
ignore = ["B008", "PIE807"] # B008: lambda in default_factory, PIE807: Prefer list over lambda
# Enable rule groups
select = [
"FAST", # FastAPI
"YTT", # flake8-2020
"ANN", # flake8-annotations
"ASYNC", # flake8-async
"B", # flake8-bugbear
"COM", # flake8-commas
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"EXE", # flake8-executable
"FIX", # flake8-fix-me
"FA", # flake8-future-annotations
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"PIE", # flake8-pie
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"TID", # flake8-tidy-imports
# "TC", # flake8-type-checking
"ARG", # flake8-unused-arguments
"FLY", # flynt
"I", # isort
"NPY", # NumPy-specific rules
"PD", # pandas-vet
"N", # pep8-naming
"PERF", # Perflint
"E", "W", # pycodestyle
"DOC", # pydoclint
"F", # Pyflakes
"PGH", # pygrep-hooks
"UP", # pyupgrade
"FURB", # refurb
]
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
ignore-fully-untyped = true
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"
inline-quotes = "single"
multiline-quotes = "single"
[tool.ruff.lint.flake8-type-checking]
quote-annotations = true
strict = false
[tool.ruff.lint.isort]
known-first-party = ["app"]
force-single-line = true
[tool.ruff.lint.pydoclint]
ignore-one-line-docstrings = true
[tool.mypy]
# Core safety, balanced for production
python_version = '3.12'
files = ['app', 'tests']
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_calls = true
check_untyped_defs = true
disallow_any_generics = true
disallow_any_explicit = false
disallow_any_unimported = true
# None and Optional handling
no_implicit_optional = true
# Warnings that catch real bugs
warn_return_any = true
warn_redundant_casts = true
warn_unreachable = true
warn_unused_ignores = true
warn_unused_configs = true
# Cleaner public APIs and safer comparisons
implicit_reexport = false
strict_equality = true
# Error message quality
show_error_codes = true
pretty = true
# Encourage precise ignores and common correctness checks
enable_error_code = [
'ignore-without-code',
'unused-awaitable',
'possibly-undefined',
'truthy-bool',
'truthy-iterable',
'redundant-expr',
'explicit-override'
]
# Pydantic v2 plugin for better type inference on models and validators
plugins = ['pydantic.mypy']
# Skip common noise and respect .gitignore
exclude_gitignore = true
exclude = '''(?x)(
^\.venv/
| ^\.tox/
| ^\.mypy_cache/
| ^\.pytest_cache/
| ^build/
| ^dist/
| ^node_modules/
| ^site-packages/
)'''
# Looser rules for tests
[[tool.mypy.overrides]]
module = ['tests.*', 'test.*']
disallow_untyped_defs = false
disallow_untyped_calls = false
check_untyped_defs = false
warn_return_any = false
disallow_any_explicit = false
# Silence auto-generated migrations
[[tool.mypy.overrides]]
module = ['migrations.*']
ignore_errors = true
# Handle optional dependencies for semantic search
[[tool.mypy.overrides]]
module = ['sqlite_vec', 'ollama']
ignore_missing_imports = true
# Allow Any from optional dependencies in embedding_service
[[tool.mypy.overrides]]
module = 'app.services.embedding_service'
disallow_any_unimported = false
[tool.pyright]
include = ["app", "tests"]
exclude = [".venv", "**/__pycache__"]
# Set a sane global baseline; strictness is then scoped below.
typeCheckingMode = "standard"
# Let Ruff handle these:
reportUnusedImport = "none"
reportUnusedVariable = "none"
reportUnnecessaryTypeIgnoreComment = "none"
# Make app/ strict
strict = ["app"]
# Per-folder overrides (execution environments)
[[tool.pyright.executionEnvironments]]
root = "app"
typeCheckingMode = "strict"
[[tool.pyright.executionEnvironments]]
root = "tests"
typeCheckingMode = "basic"
[tool.pytest.ini_options]
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]
markers = [
"integration: marks tests as integration tests (deselect with '-m \"not integration\"')",
"slow: marks tests as slow tests (deselect with '-m \"not slow\"')",
"performance: marks tests as performance tests",
]
[tool.coverage.run]
relative_files = true
source = ["app"]
[tool.coverage.report]
exclude_also = [
"def __repr__",
"if self\\.debug",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
[tool.coverage.html]
directory = "htmlcov"