-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathpyproject.toml
More file actions
304 lines (270 loc) · 8 KB
/
Copy pathpyproject.toml
File metadata and controls
304 lines (270 loc) · 8 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "surrealdb"
version = "3.0.0-alpha.4"
description = "SurrealDB python client"
readme = "README.md"
authors = [{ name = "SurrealDB" }]
license = "Apache-2.0"
keywords = ["SurrealDB", "Database"]
requires-python = ">=3.10"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Database",
"Topic :: Database :: Front-Ends",
"Topic :: Database :: Database Engines/Servers",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"aiohttp>=3.13.4",
"pydantic-core>=2.0.1",
"requests>=2.25.0",
"typing_extensions>=4.0.0; python_version<'3.12'",
"websockets>=10.0",
]
[project.urls]
homepage = "https://github.com/surrealdb/surrealdb.py"
repository = "https://github.com/surrealdb/surrealdb.py"
documentation = "https://surrealdb.com/docs/sdk/python"
[project.optional-dependencies]
embedded = [
"surrealdb-embedded==3.0.0-alpha.4",
]
pydantic = [
"pydantic>=2.12.0",
]
[dependency-groups]
dev = [
{ include-group = "test" },
"surrealdb[pydantic]",
"maturin>=1.0",
"mypy>=1.18.2",
"pyright>=1.1.407",
"ruff>=0.14.6",
"types-requests>=2.32.4", # Type stubs for requests
]
test = [
"aioresponses>=0.7.6",
"coverage>=7.0.0",
"hypothesis>=6.135.16",
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.0.0",
"responses>=0.25.0",
]
# --------------------------------------------------
# uv
# --------------------------------------------------
# aioresponses (test-only) cannot construct aiohttp>=3.14's ClientResponse,
# which now requires a `stream_writer` argument. Cap aiohttp during resolution
# until aioresponses supports 3.14. This is a resolution-only constraint and is
# NOT published in the wheel metadata, so downstream users keep `aiohttp>=3.13.4`.
[tool.uv]
constraint-dependencies = ["aiohttp<3.14"]
[tool.uv.sources]
surrealdb-embedded = { path = "embedded", editable = true }
# --------------------------------------------------
# hatch
# --------------------------------------------------
[tool.hatch.build.targets.wheel]
packages = ["src/surrealdb"]
# --------------------------------------------------
# ruff
# --------------------------------------------------
[tool.ruff]
exclude = ["src/surrealdb/__init__.py"]
[tool.ruff.lint]
select = [
"I", # isort
"UP", # pyupgrade
]
# --------------------------------------------------
# mypy
# --------------------------------------------------
[tool.mypy]
mypy_path = "src"
explicit_package_bases = true
# Import discovery
namespace_packages = true
follow_imports = "normal"
# Type checking strictness
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
strict_equality = true
warn_redundant_casts = true
warn_return_any = false
warn_unused_configs = true
warn_unused_ignores = true
# Error reporting
show_error_context = true
show_column_numbers = true
show_error_codes = true
pretty = true
# Incremental mode
incremental = true
cache_dir = ".mypy_cache"
# Platform configuration
python_version = "3.13"
# Third-party library stubs
[[tool.mypy.overrides]]
module = "surrealdb_embedded.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "aiohttp.*"
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "websockets.*"
ignore_missing_imports = true
# Relax type checking for tests - they work with Value union types extensively
[[tool.mypy.overrides]]
module = "tests.*"
# Disable strict type checking for test bodies but keep what we can
disallow_untyped_calls = false
disallow_any_generics = false
# Allow flexible indexing since query() returns Value union type
warn_return_any = false
# Don't warn about type narrowing issues
strict_optional = false
# Only these three codes remain suppressed because the public `Value` union is
# indexed into pervasively across the test suite (~3,700 sites) - the resulting
# index/union-attr/call-overload noise has no bug-catching value and enabling it
# would mean rewriting test result handling rather than a config change. Every
# other error code is now enabled, so `mypy tests/` guards against public-API
# type regressions.
disable_error_code = ["index", "union-attr", "call-overload"]
# --------------------------------------------------
# pyright
# --------------------------------------------------
[tool.pyright]
# Python version
pythonVersion = "3.13"
# Type checking mode
typeCheckingMode = "strict"
# Source configuration
include = ["src"]
extraPaths = ["embedded/src"]
exclude = [
"**/__pycache__",
"**/.pytest_cache",
"**/build",
"**/dist",
"**/.mypy_cache",
]
# Strict type checking settings (matching mypy configuration)
strictListInference = true
strictDictionaryInference = true
strictSetInference = true
strictParameterNoneValue = true
# Report settings
reportMissingTypeStubs = false
reportMissingImports = true
reportUnusedImport = true
reportUnusedClass = true
reportUnusedFunction = true
reportUnusedVariable = true
reportDuplicateImport = true
reportOptionalSubscript = true
reportOptionalMemberAccess = true
reportOptionalCall = true
reportOptionalIterable = true
reportOptionalContextManager = true
reportOptionalOperand = true
reportTypedDictNotRequiredAccess = false
reportUntypedFunctionDecorator = true
reportUntypedClassDecorator = true
reportUntypedBaseClass = true
reportUntypedNamedTuple = true
reportPrivateUsage = true
reportConstantRedefinition = true
reportIncompatibleMethodOverride = true
reportIncompatibleVariableOverride = true
reportInconsistentConstructor = true
reportOverlappingOverload = true
reportMissingSuperCall = false
reportUninitializedInstanceVariable = true
reportInvalidStringEscapeSequence = true
reportUnknownParameterType = true
reportUnknownArgumentType = false
reportUnknownLambdaType = true
reportUnknownVariableType = false
reportUnknownMemberType = false
reportMissingParameterType = true
reportMissingTypeArgument = true
reportInvalidTypeVarUse = true
reportCallInDefaultInitializer = true
reportUnnecessaryIsInstance = true
reportUnnecessaryCast = true
reportUnnecessaryComparison = true
reportAssertAlwaysTrue = true
reportSelfClsParameterName = true
reportImplicitStringConcatenation = false
reportUndefinedVariable = true
reportUnboundVariable = true
reportInvalidStubStatement = true
reportIncompleteStub = true
reportUnsupportedDunderAll = true
reportUnusedCoroutine = true
reportCallIssue = false
reportAttributeAccessIssue = false
reportArgumentType = false
reportGeneralTypeIssues = false
# --------------------------------------------------
# pytest
# --------------------------------------------------
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
markers = [
"surrealdb_v3: tests that require a running SurrealDB 3.x server (skipped otherwise)",
]
addopts = [
"--strict-markers",
"--strict-config",
"--verbose",
"--tb=short",
]
filterwarnings = [
"ignore::pytest.PytestUnraisableExceptionWarning",
]
# --------------------------------------------------
# coverage
# --------------------------------------------------
[tool.coverage.run]
source = ["src"]
omit = [
"*/tests/*",
"*/test_*",
"*/__pycache__/*",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if 0:",
"if __name__ == .__main__.:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
]