Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
345 lines (323 loc) · 12 KB
/
Copy pathpyproject.toml
File metadata and controls
345 lines (323 loc) · 12 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
[build-system]
requires = [
"cython",
"cmake>=3.24.2,<3.28",
"setuptools-rust<2",
"patchelf>=0.17.0.0; sys_platform == 'linux'",
]
build-backend = "setuptools.build_meta"
[project]
name = "ddtrace"
version = "4.18.0rc1"
description = "Datadog APM client library"
readme = "README.md"
license = { text = "LICENSE.BSD3" }
# ddtrace has many sub-components which can break when CPython internals
# change over versions, e.g. profiling. So we explicitly mark incompatibility
# with versions we don't support yet.
requires-python = ">=3.9,<3.16"
authors = [
{ name = "Datadog, Inc.", email = "dev@datadoghq.com" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dependencies = [
"bytecode>=0.19.0,<1; python_version>='3.15.0'",
"bytecode>=0.17.0,<1; python_version>='3.14.0'",
"bytecode>=0.16.0,<1; python_version>='3.13.0'",
"bytecode>=0.15.1,<1; python_version~='3.12.0'",
"bytecode>=0.14.0,<1; python_version~='3.11.0'",
"bytecode>=0.13.0,<1; python_version<'3.11'",
"ddtrace-internal==0.2.0",
"envier~=0.6.1",
"opentelemetry-api>=1,<2",
# TODO: lift the `!=2.2.0` exclusion once wrapt ships a release that
# reverts/fixes the descriptor regression introduced in
# https://github.com/GrahamDumpleton/wrapt/commit/ae93dd71c378161ff3643c9a1f708f66f97f3b5d
# wrapt 2.2.0's `FunctionWrapper.__get__(None, owner)` calls `tp_descr_get`
# with `Py_None` instead of `NULL`, which breaks class-level access to any
# C method_descriptor we wrap (e.g. `_pickle.Unpickler.load`,
# `asyncpg.protocol.protocol.BaseProtocol.execute`). See incident 53643.
"wrapt>=1,!=2.2.0,<3",
]
[project.optional-dependencies]
opentelemetry = [
"opentelemetry-exporter-otlp>=1,<2",
]
openfeature = [
"openfeature-sdk>=0.8,<1",
]
[project.scripts]
ddtrace-run = "ddtrace.commands.ddtrace_run:main"
_dd_crashtracker_receiver = "ddtrace.commands._dd_crashtracker_receiver:main"
[project.entry-points.opentelemetry_context]
ddcontextvars_context = "ddtrace.internal.opentelemetry.context:DDRuntimeContext"
[project.entry-points.pytest11]
ddtrace = "ddtrace.testing.internal.pytest.entry_point"
[project.entry-points.'mlflow.request_header_provider']
datadog = "ddtrace.contrib.internal.mlflow.auth_plugin:DatadogHeaderProvider"
[project.entry-points.'ddtrace.integration_hooks']
anthropic = "ddtrace.llmobs._contrib.anthropic"
botocore = "ddtrace.llmobs._contrib.botocore"
crewai = "ddtrace.llmobs._contrib.crewai"
google_adk = "ddtrace.llmobs._contrib.google_adk"
langchain = "ddtrace.llmobs._contrib.langchain"
langgraph = "ddtrace.llmobs._contrib.langgraph"
claude_agent_sdk = "ddtrace.llmobs._contrib.claude_agent_sdk"
google_genai = "ddtrace.llmobs._contrib.google_genai"
llama_index = "ddtrace.llmobs._contrib.llama_index"
litellm = "ddtrace.llmobs._contrib.litellm"
mcp = "ddtrace.llmobs._contrib.mcp"
mistralai = "ddtrace.llmobs._contrib.mistralai"
openai_agents = "ddtrace.llmobs._contrib.openai_agents"
pydantic_ai = "ddtrace.llmobs._contrib.pydantic_ai"
openai = "ddtrace.llmobs._contrib.openai"
typesafe = "ddtrace.llmobs._contrib.typesafe"
mlflow = "ddtrace.llmobs._contrib.mlflow"
vertexai = "ddtrace.llmobs._contrib.vertexai"
vllm = "ddtrace.llmobs._contrib.vllm"
[project.entry-points.'ddtrace.products']
"apm-tracing-rc" = "ddtrace.internal.remoteconfig.products.apm_tracing"
"llmobs" = "ddtrace.llmobs._product"
"code-origin-for-spans" = "ddtrace.debugging._products.code_origin.span"
"dynamic-instrumentation" = "ddtrace.debugging._products.dynamic_instrumentation"
"exception-replay" = "ddtrace.debugging._products.exception_replay"
"profiler" = "ddtrace.internal.profiling.product"
"live-debugger" = "ddtrace.debugging._products.live_debugger"
"error-tracking" = "ddtrace.errortracking.product"
"openfeature" = "ddtrace.internal.openfeature.product"
"remote-configuration" = "ddtrace.internal.remoteconfig.products.client"
"symbol-database" = "ddtrace.internal.symbol_db.product"
"appsec" = "ddtrace.internal.appsec.product"
"aiguard" = "ddtrace.internal.aiguard.product"
"iast" = "ddtrace.internal.iast.product"
"sca" = "ddtrace.internal.sca.product"
"tracer" = "ddtrace._trace.product"
[project.urls]
"Bug Tracker" = "https://github.com/DataDog/dd-trace-py/issues"
Changelog = "https://github.com/DataDog/dd-trace-py/releases"
Documentation = "https://ddtrace.readthedocs.io/en/stable/"
Homepage = "https://github.com/DataDog/dd-trace-py"
"Source Code" = "https://github.com/DataDog/dd-trace-py/"
[dependency-groups]
lint = [
"click==8.1.7",
"cython-lint==0.18.1",
"codespell==2.4.1",
"bandit==1.8.2",
"mypy==1.15.0",
"coverage==7.3.0",
"envier==0.6.1",
"openfeature-sdk~=0.8.0",
"types-docutils==0.19.1.1",
"types-protobuf==3.20.4.5",
"types-PyYAML==6.0.12.2",
"types-setuptools==65.6.0.0",
"ddapm-test-agent==1.69.0",
# The newer Datadog-repackaged grpcio release lacks CPython 3.10 wheels.
"grpcio==1.80.0; python_version<='3.10'",
"grpcio==1.82.1; python_version>='3.11'",
"packaging==23.1",
"pygments==2.16.1",
"ruff==0.14.10",
"clang-format==18.1.5",
"cmake-format==0.6.13",
"ruamel.yaml==0.18.6",
"ast-grep-cli==0.39.4",
# Lint extra; 0.19.0 matches the runtime lower bound so uv can resolve
# both extras when requires-python includes 3.15.
"bytecode==0.19.0; python_version >= '3.15'",
"bytecode==0.17.0; python_version < '3.15'",
]
clean = [
"cython",
"cmake>=3.24.2,<3.28",
"setuptools-rust<2",
"setuptools-scm[toml]>=4",
]
[tool.cython-lint]
max-line-length = 120
exclude = '''
(
\.worktrees/
| \.cache/
| .venv*
| \.sg
| ddtrace/profiling/
| test_ci_visibility_api_client_skippable_real_world_responses\.py
)
'''
[tool.pyright]
exclude = [
"**/__pycache__",
".git",
".ddtox",
".sg",
".tox",
".venv",
".worktrees",
]
[tool.bandit]
targets = ["ddtrace/"]
# TODO: Remove excludes
exclude_dirs = [
"ddtrace/vendor/",
"ddtrace/appsec/_iast/_taint_tracking/_vendor/",
"ddtrace/commands/ddtrace_run.py",
"ddtrace/ext/git.py",
"ddtrace/ext/test.py",
"ddtrace/internal/datadog/profiling/ddup/test/interface.py",
"ddtrace/internal/module.py",
"ddtrace/internal/rate_limiter.py",
"ddtrace/internal/uwsgi.py",
"ddtrace/sourcecode/_utils.py",
"scripts/ext_cache.py",
"scripts/check_no_new_aidev_anchors.py",
"setup.py",
]
[tool.ruff]
# This exclude list applies to both linting and formatting
exclude = [
".venv*",
".git",
".worktrees",
"__pycache__",
".eggs",
"*.egg",
".sg",
"build",
"ddtrace/__init__.py",
"ddtrace/vendor/*",
"ddtrace/appsec/_iast/_taint_tracking/_vendor/*",
"tests/profiling/collector/pprof_*pb2.py",
"tests/contrib/grpc/hello_pb2.py",
"tests/contrib/django_celery/app/*",
"tests/contrib/protobuf/schemas/**/*.py",
"tests/coverage/included_path/py39_line_numbers.py",
"tests/appsec/iast/fixtures/ast/str/non_utf8_content.py",
"tests/appsec/iast/fixtures/aspects/str/non_utf8_content.py",
# IAST fixture files: these exist specifically to test AST patching of
# str() calls, __future__ imports, and encoding declarations. UP rules
# must not modify them.
"tests/appsec/iast/fixtures/ast/str/function_str.py",
"tests/appsec/iast/fixtures/ast/str/class_no_str.py",
"tests/appsec/iast/fixtures/ast/str/future_import_class_str.py",
"tests/appsec/iast/fixtures/ast/str/future_import_function_str.py",
"tests/appsec/iast/fixtures/aspects/str/function_str.py",
"tests/appsec/iast/fixtures/aspects/str/class_no_str.py",
"tests/appsec/iast/fixtures/aspects/str/future_import_class_str.py",
"tests/appsec/iast/fixtures/aspects/str/future_import_function_str.py",
"tests/appsec/iast/fixtures/integration/print_str.py",
"tests/appsec/iast/fixtures/non_re_module.py",
"tests/appsec/iast/fixtures/propagation_path.py",
"tests/appsec/iast/_ast/fixtures/annotated_code.py",
"tests/appsec/iast/_ast/fixtures/del_variables_at_runtime.py",
# IAST benchmark fixture: used by IAST aspects tests. UP032 (f-string)
# converts .format() calls that IAST taint tracking intercepts.
"benchmarks/bm/iast_fixtures/str_methods.py",
"tests/lib-injection/dd-lib-python-init-test-protobuf-old/addressbook_pb2.py",
"tests/appsec/iast/aspects/test_template_string_aspect.py", # Python 3.14+ syntax (t-strings)
"benchmarks/bm/iast_fixtures/template_strings.py", # Python 3.14+ syntax (t-strings)
# Version-gated wrapping tests: each uses syntax newer than the project minimum,
# so the min-version ruff parser rejects them and they are excluded from ruff on
# every interpreter (not linted). conftest.py collect_ignores them below their
# target interpreter at test time. Mirrors test_template_string_aspect.py above.
"tests/wrapping/test_match_py310.py", # match/case (3.10+)
"tests/wrapping/test_except_star_py311.py", # except* (3.11+)
"tests/wrapping/test_pep695_py312.py", # PEP 695 generics (3.12+)
"tests/wrapping/test_tstrings_py314.py", # PEP 750 t-strings (3.14+)
]
lint.ignore = [
"A003",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D200",
"D202",
"D204",
"D205",
"D208",
"D210",
"D300",
"D400",
"D401",
"D403",
"D404",
"D413",
"E203",
"E231",
"E721",
"G201",
"UP007", # non-pep604-annotation-union (requires py3.10+ for X|Y syntax)
"UP022", # replace-stdout-stderr (needs manual review for subprocess semantics)
"UP028", # yield-in-for-loop (needs manual review for generator semantics)
"UP030", # format-literals (needs manual review for format string semantics)
"UP031", # printf-string-formatting (needs manual conversion to f-strings)
"UP035", # deprecated-import (needs manual import path updates)
"UP036", # outdated-version-block (needs manual version-block review)
"UP045", # non-pep604-annotation-optional (requires py3.10+ for X|None syntax)
]
line-length = 120
# Allow experimental/preview checks
lint.preview = true
lint.explicit-preview-rules = true
lint.select = [
"A",
"D",
"E",
"F",
"G",
"I",
"PLW0244", # redefined-slots-in-subclass
"UP", # pyupgrade rules (targets py39 based on requires-python)
"W",
]
lint.unfixable =[
"F401",
]
[tool.ruff.lint.per-file-ignores]
# Test depends on mock.Mock().__class__.__module__ being "mock" (not "unittest.mock")
"tests/contrib/dbapi/test_dbapi.py" = ["UP004", "UP008", "UP026"]
"tests/contrib/dbapi_async/test_dbapi_async.py" = ["UP004", "UP008", "UP026"]
# Line numbers referenced by debugger span decoration probes
"tests/submod/traced_stuff.py" = ["UP009"]
# Subprocess test body uses quoted annotations because it's exec'd without
# `from __future__ import annotations` and pprof_pb2 is pyi-only
"tests/profiling/collector/test_memalloc.py" = ["UP037"]
# Test asserts exact open() call args including mode="r"
"ddtrace/internal/container.py" = ["UP015"]
# IAST leak harness: str.format() calls exercise the format_aspect taint
# propagation path. Converting to f-strings removes that coverage.
"scripts/iast/mod_leak_functions.py" = ["UP032"]
[tool.ruff.format]
# Formatter-specific settings
# The exclude list from [tool.ruff] is inherited automatically
# Additional formatter options can be added here if needed
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
[tool.ruff.lint.pydocstyle]
convention = "pep257"
[tool.ruff.lint.isort]
force-single-line = true
lines-after-imports = 2
force-sort-within-sections = true
known-first-party = [ "ddtrace" ]
relative-imports-order = "furthest-to-closest"