Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
390 lines (364 loc) · 11.3 KB
/
Copy pathpyproject.toml
File metadata and controls
390 lines (364 loc) · 11.3 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "10xgraph-api"
version = "0.7.0"
description = "Production server for 10xGraph agents (formerly 10xscale-agentflow-cli). Serves a compiled graph over REST, SSE, WebSocket, realtime audio and AG-UI with JWT or custom auth, scoped authorization on every endpoint, owner-only threads and rate limiting, and generates Docker Compose and Kubernetes files. Includes the 10xgraph CLI. MIT licensed, self-hosted."
readme = "README.md"
license = {text = "MIT"}
requires-python = ">=3.12"
authors = [
{name = "Shudipto Trafder", email = "shudiptotrafder@gmail.com"},
]
maintainers = [
{name = "Shudipto Trafder", email = "shudiptotrafder@gmail.com"},
{name = "10xScale", email = "contact@10xscale.ai"},
]
keywords = [
"10xgraph",
"10xscale",
"agentflow",
"agents",
"ai-agents",
"multi-agent",
"agent-server",
"agent-deployment",
"llm",
"fastapi",
"api-server",
"rest-api",
"sse",
"websocket",
"realtime-audio",
"ag-ui",
"jwt",
"authentication",
"authorization",
"rbac",
"multi-tenant",
"rate-limiting",
"self-hosted",
"production",
"docker",
"kubernetes",
"cli",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
]
dependencies = [
# 0.10.0 is the first core release under the 10xgraph name (import `tenxgraph`).
# It ships `interrupt()`, per-run `remote_tools` and `validate_skill`, which
# AG-UI, `resume` and `10xgraph skills --validate` use.
"10xgraph>=0.10.0,<2.0",
# Pre-1.0 and major-version-risky deps are capped; floors are the versions
# the suite is verified against.
"fastapi>=0.116,<1.0",
"gunicorn>=23.0,<24",
"orjson>=3.11,<4",
"platformdirs>=4.0,<5",
"python-multipart>=0.0.19,<0.1",
"pydantic>=2.13,<3",
"pydantic-settings>=2.3,<3",
"uvicorn>=0.30,<1.0",
"typer>=0.17,<1.0",
"python-dotenv>=1.0,<2",
"questionary>=2.0,<3",
"rich>=14.0,<15",
]
[project.urls]
Homepage = "https://10xgraph.com"
Repository = "https://github.com/10xGraph/10xgraph-api"
Issues = "https://github.com/10xGraph/10xgraph-api/issues"
Documentation = "https://10xgraph.com"
Changelog = "https://github.com/10xGraph/10xgraph-api/blob/main/CHANGELOG.md"
[project.optional-dependencies]
sentry = [
"sentry-sdk>=2.10.0",
]
firebase = [
"firebase-admin>=6.5.0",
"oauth2client>=4.1.3",
]
snowflakekit = [
"snowflakekit>=0.1.1,<1.0",
]
redis = [
"redis>=5.0.7,<7",
]
jwt = [
"PyJWT>=2.8,<3",
]
media = [
"textxtract[pdf,docx,html,xml,md]>=0.2.0",
]
gcloud = [
"google-cloud-logging",
]
otel = [
"opentelemetry-api>=1.20.0",
"opentelemetry-sdk>=1.20.0",
"opentelemetry-instrumentation-fastapi>=0.40b0",
"opentelemetry-exporter-otlp>=1.20.0",
]
ag-ui = [
"ag-ui-protocol>=1.0,<2",
]
[project.scripts]
10xgraph = "tenxgraph_api.cli.main:main"
# Deprecated alias for the pre-rename command name; removed in 2.0.
agentflow = "tenxgraph_api.cli.main:legacy_main"
[tool.setuptools]
zip-safe = false
include-package-data = true
[tool.setuptools.packages.find]
where = ["."]
include = ["tenxgraph_api*", "agentflow_cli*"]
exclude = ["tests*", "docs*", "__pycache__*"]
[tool.setuptools.package-data]
# `**/*` (not extension globs) so scaffolding dotfiles - .env.example,
# .python-version - and templates/prod/pyproject.toml reach the wheel.
# Without them `10xgraph init` fails on a PyPI install.
"tenxgraph_api" = ["py.typed", "**/*"]
[tool.setuptools.exclude-package-data]
# Tool caches that appear if the prod template is ever run in place.
"*" = [
"**/.ruff_cache/**",
"**/.pytest_cache/**",
"**/.mypy_cache/**",
"**/htmlcov/**",
"**/*.py[cod]",
]
[tool.ruff]
line-length = 100
target-version = "py312"
lint.fixable = ["ALL"]
lint.select = [
"E", # pycodestyle
"W", # pycodestyle
"F", # Pyflakes
"PL", # pylint
"I", # isort
"B", # flake8-bugbear
"A", # flake8-builtins
"S", # flake8-bandit
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"PIE", # flake8-pie
"Q", # flake8-quotes
"RET", # flake8-return
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"RUF", # Ruff-specific rules
"YTT", # flake8-2020
"UP", # pyupgrade
"C4", # flake8-comprehensions
"PTH", # flake8-use-pathlib
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"T20", # flake8-print
]
lint.ignore = [
"UP006", # https://github.com/charliermarsh/ruff/pull/4427
"UP007", # https://github.com/charliermarsh/ruff/pull/4427
# Mutable class attributes should be annotated with `typing.ClassVar`
# Too many violations
"RUF012",
# Logging statement uses f-string
"G004",
#B904 Within an `except` clause, raise exceptions with
#`raise ... from err` or `raise ... from None` to distinguish
#them from errors in exception handling
"B904",
#Do not perform function call `Injected` in argument defaults
"B008",
"ISC001",# flake8-implicit-str-concat
]
# Allow unused variables when underscore-prefixed.
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
exclude = [
"venv",
".venv",
# Emitted scaffolding, not library code. These paths must match from the repo
# root - the previous `*/10xgraph-api/...` patterns had a hyphen typo and a
# leading `*/`, so neither ever matched and templates were being linted.
"tenxgraph_api/cli/templates",
]
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.ruff.lint.per-file-ignores]
# Patterns are matched against paths relative to the repo root. A leading `*/`
# never matches a top-level directory, which is why these previously had no effect.
"bin/**" = ["E402", "S603", "T201", "S101"]
"scripts/**" = ["E402", "S603", "T201", "S101", "INP001"]
"**/migrations/**" = ["E402", "S603", "T201", "S101"]
"**/__init__.py" = ["E402", "S603", "T201", "S101", "F401"]
# Test code: asserts, subprocess calls, prints, magic numbers, bound-but-unused
# locals (the act/assert split), and long/complex test bodies are all normal.
"tests/**" = [
"E402", "E501", "E722", "E731",
"S101", "S104", "S105", "S106", "S108", "S110", "S113", "S603", "S607",
"T201", "F841", "RET504", "SIM105", "SIM118", "SIM222",
"PTH109", "PTH123", "RUF013",
"PLR2004", "PLR0912", "PLR0913", "PLR0915", "INP001", "ARG001", "SIM117",
]
# Examples are illustrative scripts: they print, they are not a package, and
# they hardcode demo values on purpose.
"examples/**" = [
"T201", "INP001", "PLR2004", "S104", "S105", "RET504", "E501",
]
[tool.ruff.lint.isort]
lines-after-imports = 2
known-first-party = ["src"]
[tool.ruff.lint.pylint]
max-args = 10
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
[tool.mypy]
python_version = "3.12"
files = ["tenxgraph_api"]
# Templates are emitted code, not library code - they reference modules that only
# exist in a scaffolded project.
exclude = "^tenxgraph_api/cli/templates/"
ignore_missing_imports = true
follow_imports = "silent"
warn_redundant_casts = true
warn_unused_ignores = false
no_implicit_optional = true
check_untyped_defs = false
disallow_untyped_defs = false
show_error_codes = true
pretty = true
[[tool.mypy.overrides]]
module = ["tenxgraph_api.cli.templates.*"]
ignore_errors = true
# --- Phased adoption backlog -------------------------------------------------
# mypy was introduced in the 0.5.0 readiness pass against a codebase that had
# never been type checked. Everything not listed here is checked and clean, so
# CI fails on any *new* type error. Work these modules off the list one at a
# time; do not add to it.
#
# graph_service.py 14 errors (call-arg, union-attr)
# multimodal_preprocessor.py 7 errors (union-attr, arg-type)
# permissions.py 5 errors (type-abstract from the InjectAPI
# pattern - likely needs a Protocol)
# auth_backend.py 3 errors (call-arg)
# eval.py 3 errors (list invariance; use Sequence)
# graph/router.py 2 errors (type-abstract, same as permissions)
# settings/media_settings/
# setup_middleware.py 1 error each (assignment, var-annotated)
[[tool.mypy.overrides]]
module = [
"tenxgraph_api.src.app.routers.graph.services.graph_service",
"tenxgraph_api.src.app.routers.graph.services.multimodal_preprocessor",
"tenxgraph_api.src.app.routers.graph.router",
"tenxgraph_api.src.app.core.auth.permissions",
"tenxgraph_api.src.app.core.auth.auth_backend",
"tenxgraph_api.src.app.core.config.settings",
"tenxgraph_api.src.app.core.config.media_settings",
"tenxgraph_api.src.app.core.config.setup_middleware",
"tenxgraph_api.cli.commands.eval",
]
ignore_errors = true
[tool.bandit]
exclude_dirs = ["tests", "tenxgraph_api/cli/templates", ".venv", "venv"]
skips = ["B101", "B611", "B601"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.pytest.ini_options]
env = [
"ENVIRONMENT=pytest",
]
testpaths = [
"tests",
]
pythonpath = [
".",
]
filterwarnings = [
"ignore::DeprecationWarning"
]
addopts = [
# Limit coverage collection to the local project package only
"--cov=tenxgraph_api",
"--cov-report=html",
"--cov-report=term-missing",
"--cov-report=xml",
"--cov-branch",
"--cov-fail-under=80",
"--strict-markers",
"-v"
]
markers = [
"integration: requires real external services (Redis, Postgres); run with --integration",
"slow: takes more than a few seconds",
]
[tool.coverage.run]
# Only measure the first-party project package
source = ["tenxgraph_api"]
branch = true
omit = [
"*/__init__.py", # often trivial
"*/tests/*", # exclude test code
"*/migrations/*",
"*/scripts/*",
"*/venv/*",
"*/.venv/*",
"*/tenxgraph_api/cli/templates/prod/*",
"*/tenxgraph_api/cli/templates/dev/*",
]
[tool.coverage.report]
exclude_lines = [
"if __name__ == '__main__':",
"pragma: no cover",
"@abc.abstractmethod",
"@abstractmethod",
"raise NotImplementedError",
]
show_missing = true
[tool.coverage.paths]
source = [
"tenxgraph_api",
"*/site-packages/tenxgraph_api",
]
[tool.pytest-env]
ENVIRONMENT = "pytest"
[dependency-groups]
dev = [
"10xgraph>=0.10.0",
"snowflakekit",
"pytest>=8.4.2",
"pytest-asyncio>=1.2.0",
"pytest-cov>=7.0.0",
"pytest-env>=1.1.5",
"pytest-xdist>=3.8.0",
"pre-commit>=3.8.0",
"mypy>=1.11.0",
"ruff==0.5.2",
"mkdocs-gen-files==0.5.0",
"mkdocstrings==0.25.2",
"mypy-extensions==1.0.0",
"httpx==0.27.0",
"lib==4.0.0",
"markdown-it-py==3.0.0",
"requests==2.32.3",
"redis>=5.0.7",
"PyJWT",
"textxtract[pdf,docx,html,xml,md]>=0.2.0",
# The ag-ui extra, so the AG-UI router tests run in CI instead of failing.
"ag-ui-protocol>=1.0,<2",
]