Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
120 lines (107 loc) · 3.65 KB
/
Copy pathpyproject.toml
File metadata and controls
120 lines (107 loc) · 3.65 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
[project]
license = { text = "Apache-2.0" }
name = "python-test-executor"
version = "1.0.0"
description = "Executes Python code in subprocesses with timeout enforcement and syntax validation. Includes a library for parsing static analysis tool output."
authors = [{name = "Nonagentic", email = "dev@nonagentic.ai"}]
requires-python = ">=3.14"
dependencies = [
"fastapi>=0.115.0",
# Explicit floor for PYSEC-2026-161 (starlette <1.0.1). fastapi pulls
# starlette transitively; pin the fixed floor so pip-audit stays clean.
"starlette>=1.0.1",
"uvicorn[standard]>=0.35.0",
"pydantic>=2.12.5",
"psutil>=5.9.0",
"redis>=7.1.0",
"structlog>=24.4.0",
"requests>=2.31.0",
# OpenTelemetry
"opentelemetry-api>=1.24.0",
"opentelemetry-sdk>=1.24.0",
"opentelemetry-exporter-otlp-proto-http>=1.24.0",
"opentelemetry-instrumentation-fastapi>=0.53b1",
# RUNTIME, not dev: POST /execute shells out to `sys.executable -m pytest`
# (src/test_service.py). With pytest only in the dev group, the
# `uv sync --frozen --no-dev` image would fail every real /execute request
# while /health and the (subprocess-mocked) unit suite stayed green.
"pytest>=9.0.3",
# Submitted test_code may import hypothesis: coding-testing forwards a
# `with_hypothesis` flag to this executor, and the pre-lock image shipped it.
"hypothesis>=6.98.0",
]
[project.optional-dependencies]
dev = [
"pytest>=9.0.2",
"pytest-asyncio>=0.24.0",
"pytest-cov>=6.0.0",
"ruff==0.17.4",
"ty==0.0.100",
"respx>=0.22.0",
"httpx>=0.27.0",
]
[build-system]
requires = ["setuptools>=75.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
package-dir = {"" = "src"}
[dependency-groups]
dev = [
"pytest>=9.0.2",
"pytest-asyncio>=0.24.0",
"pytest-cov>=6.0.0",
"ruff==0.17.4",
"detect-secrets",
"pip-audit>=2.10.0",
"ty==0.0.100",
"respx>=0.22.0",
"httpx>=0.27.0",
# pip-audit -> pip-api -> pip: floor past PYSEC-2026-196 and PYSEC-2026-3721 (fixed in pip 26.1.2 and 26.2)
"pip>=26.2",
]
[tool.ruff]
line-length = 100
target-version = "py314"
src = ["."]
[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP"]
ignore = ["E501"]
[tool.ruff.lint.isort]
known-first-party = ["src"]
[tool.ty.environment]
python-version = "3.14"
[tool.ty.rules]
# Renamed by ty 0.0.10x (the archetype pins the checker, so the config follows it):
# `unresolved-import` -> `import-not-found`.
import-not-found = "ignore"
[tool.pytest.ini_options]
asyncio_mode = "auto"
pythonpath = ["."]
testpaths = ["tests"]
addopts = "-v --cov=src --cov-report=term-missing -m 'not integration'"
markers = [
"integration: marks tests as integration tests",
"e2e: marks tests as end-to-end tests",
]
filterwarnings = [
"ignore::pytest.PytestCollectionWarning",
]
[tool.coverage.run]
source = ["src"]
[tool.coverage.report]
fail_under = 80
# Honoured by the shared python-service archetype via `bandit -c pyproject.toml`
# (Phase 0 gitops #725). Both findings are accepted-risk for this code-execution
# sandbox; the only REAL bandit class (B314 XXE) is absent — tool output is parsed
# as JSON/regex, never XML.
[tool.bandit]
skips = [
# B108 hardcoded_tmp_directory: test_service.py writes the submitted code to
# /tmp/test_code_<uuid7>.py before subprocess exec. uuid7 names defeat the
# symlink/predictable-name attack and the container's /tmp is ephemeral.
"B108",
# B104 hardcoded_bind_all_interfaces: host="0.0.0.0" in the dev-only
# `if __name__ == "__main__"` block. Production runs via the Dockerfile CMD
# (`uvicorn --host 0.0.0.0`); a containerized service must bind all interfaces.
"B104",
]