Repository navigation
Conversation
ddtrace.internal.codeowners has been extracted to datadog-apm-python as _ddtrace_internal_base.codeowners (published as ddtrace-internal-base). Replace the vendored implementation with a bridge that re-exports the extracted package, so there is a single source of truth. The bridge fails loudly if the package is missing; the vendored code remains in git history. Also pin the package in the lint dependency group: mypy runs with --only-group lint, and without the installed package ignore_missing_imports=true would silently degrade Codeowners to Any downstream (e.g. bdd.py returning-Any). Verified locally with a wheel built from datadog-apm-python: internal, ci_visibility::testing, and detect_global_locks suites pass, along with scripts/lint checks.
The extracted module moved: datadog-apm-python absorbed ddtrace-internal-base into ddtrace-internal, so the bridge imports _ddtrace_internal.codeowners and the dependency it needs is one ddtrace already has, at a newer version. That makes this a version bump rather than a new dependency: ddtrace-internal goes from 0.2.0 to 0.3.0, the release that carries codeowners, and ddtrace-internal-base disappears from the runtime dependencies, the lint group and both requirements CSVs. The release note says the same -- mirrors must carry the new version, not a new distribution. CSVs regenerated with scripts/requirements_to_csv.py.
The aws_lambda suite depends on datadog-lambda, which transitively depends on the released ddtrace, so its environment lock pins the full transitive closure, including ddtrace-internal. scripts/run-tests strips the ddtrace pin when installing the locally built ddtrace, but keeps the ddtrace-internal pin, which must match the local wheel's requirement. With the bridge pointing at ddtrace-internal 0.3.0, the stale 0.2.0 pin made the env build unsatisfiable (uv exit 1 for 6abbc5115929, Python 3.15 job). Same manual bump as 96e3c67 (ddtrace-internal 0.1.0 -> 0.2.0). The pin will track 0.3.0 again naturally once a released ddtrace that requires ddtrace-internal 0.3.0 is past the lock cooldown.
Coverage imported ddtrace.internal.packages only for the four sysconfig paths it excludes by default (stdlib, platstdlib, platlib, purelib). That import pulls in about 23 ddtrace modules, including the native extension, threads and uwsgi, which coverage otherwise does not need. Resolve the same four paths with sysconfig, exactly as packages.py does, so coverage can later be extracted into its own package without dragging that machinery along. A test pins the result to the values packages.py computes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The pytest plugin and the BDD plugin imported ddtrace, and the logging and selenium contrib patches, directly. Move those touchpoints behind lazy helpers in tracer_api/context.py (get_tracer, enable_log_correlation, enable_selenium_integration), next to the existing trace filter and patch-all helpers. No behavior change. It makes tracer_api the single seam between test optimization and the tracer, so the plugin can later be extracted into its own package with the tracer integration injected by dd-trace-py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every other ddtrace.testing module logs through logging.getLogger; the xdist helpers were the exception, importing ddtrace.internal.logger. Its extras (product rate limiting, ddtrace.* level lookup) do not apply to this module's records, so the stdlib logger is equivalent here and drops one more ddtrace internal from the plugin. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
With tracer integration off, a pytest session must not make ddtrace.testing import the tracer, _monkey or the logging/selenium contrib. sys.modules cannot show this in-tree, since importing ddtrace.testing runs ddtrace/__init__, so the test records imports by importer. Positive controls cover tracer integration on and --ddtrace-patch-all. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The module created a logger it never used. Removing it makes ddtrace.internal.utils.time stdlib-only, so it can move to the ddtrace-internal package alongside the other shared utilities (coverage and test optimization both use StopWatch). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…th env Package split: ddtrace.internal.settings.env and ddtrace.internal.logger move to the ddtrace-internal package, while the generated registry (supported-configurations.json, its generator, hook and lint check) stays in dd-trace-py so adding a config remains a dd-trace-py-only change. env no longer imports _supported_configurations. It exposes register_supported_configurations(), first registration wins, and ddtrace/__init__.py calls it before anything else is imported. Python runs the package __init__ before any submodule, so registration precedes every env lookup. Before registration env is inert: no key validation (no debug log) and no aliases, i.e. exact-key lookups in os.environ. Behavior once ddtrace is imported is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ddtrace-internal 0.4.0 depends on wrapt, so the lint environment (which installs ddtrace-internal) now gets wrapt with its type stubs, and mypy starts reporting ObjectProxy generics in forksafe and safety. Ignore them at the two call sites; no behaviour change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Alias settings.env, logger, module, compat, assembly, utils.cache, utils.paths, utils.obfuscation, utils.time, bytecode_injection.core and every ddtrace.internal.coverage module to their package counterparts (sys.modules replacement at runtime, static re-exports for mypy), and import the moved names into the modules that keep other code (utils, utils.formats, utils.inspection, bytecode_injection). ddtrace/__init__ registers the supported-configurations registry with _ddtrace_internal.settings.env directly. Depend on ddtrace-internal 0.4.0.dev0 and ddtrace-coverage 0.1.0.dev0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
uv pip install runs inside the testrunner container, which cannot see the host's /tmp or any index carrying the 0.x.dev0 builds. Point uv at the wheels copied into the (git-ignored) .cache/split-wheels. Never upstream. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`import _ddtrace_internal.settings.env as _impl` resolves the final component by attribute access, and the settings package re-exports dd_environ as `env`, shadowing the submodule: the bridge then replaced itself with the EnvConfig instance. Use importlib.import_module, which reads sys.modules. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
test_py315_feature_gate_does_not_follow_next_max parses the sources of the modules that gate on is_at_least_py(3, 15). The coverage ones are bridges now, so read them from the _ddtrace_coverage package instead. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ache" This reverts commit 99015c5.
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
Contributor
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 75 Pipeline jobs failed
ℹ️ InfoNo other issues found (see more)🧪 All tests passed Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 3ea18bb | Docs | View more details | Give us feedback! |
ddtrace-internal depends on wrapt, so pinning it in the lint group pulled wrapt into mypy's environment. Every wrapt 2.x ships type information (inline py.typed in 2.0-2.1, wrapt-stubs from 2.2), which mypy then checks our wrapt usage against: 47 errors once the whole tree is checked. Pin wrapt<2 in the lint group so mypy keeps seeing an untyped wrapt, as it did before the bridge; wrapt 1.x is within the runtime range and still tested. This replaces the four type-ignores added earlier in this branch, which only covered the files the commit hooks had checked. The proper typing fix is #21989. The bridges' TYPE_CHECKING blocks fall back to a module __getattr__, so any name missing from them is typed Any instead of failing. compat lacked singledispatchmethod (which made every @singledispatchmethod in symbol_db an untyped decorator), and the coverage bridges declared no names at all. Re-export every name dd-trace-py imports from them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Prototype for discussion, not for merge. This is Phase 1 of a local end-to-end prototype of the package split, for the team to review before the real PRs land. It pairs with DataDog/datadog-apm-python#81 (
ddtrace-internaladditions plus the newddtrace-coveragepackage). Plan: DataDog/datadog-apm-python#80. Phase 2 (switching toddtrace-native) is #21993, stacked on this one.Contents:
utils.timelogger);gnufede/coverage-decouple,gnufede/testing-decouple);sys.modules[__name__] = import_module(...)), plus aTYPE_CHECKINGre-export block for mypy. As a result,ddtrace.internal.X is _ddtrace_internal.Xfor env, logger, module, compat, cache, paths, obfuscation and time, and for every coverage module, so there's a single copy of state.utils/__init__,utils/formats,utils/inspection,bytecode_injection/__init__) import the moved names and keep the rest._ddtrace_internal.settings.envfromddtrace/__init__.py.test_compat_version_bounds.py) now reads the moved coverage sources from_ddtrace_coverage.ddtrace-internal==0.4.0.dev0andddtrace-coverage==0.1.0.dev0. These aren't published, so CI here will fail to resolve them. The prototype was run with locally built wheels.Testing
Docker test environments, Python 3.12, compared with the same environments on
main(1481176660):Risks / what the real PRs need
_ddtrace_internal.*, ...) aren't underddtrace. That's fixed separately in chore(logging): apply the ddtrace logger config to package loggers #21987, which also keeps the_DD_<PRODUCT>_LOG_LEVELnames.from X import *loses private names and anything not in__all__. Useimportlib.import_module, neverimport a.b as x:settings.envis shadowed by an attribute with the same name.ddtrace-internaldepends on wrapt, so adding it to thelintgroup pulls wrapt into mypy's environment. Every wrapt 2.x ships type information (inlinepy.typedin 2.0–2.1,wrapt-stubsfrom 2.2), which causes 47 errors on the full tree. This prototype pinswrapt<2in thelintgroup, so mypy keeps seeing an untyped wrapt as it does today. wrapt 1.x is within the runtime range and still tested. The proper typing fix is chore(typing): type wrapt proxies so mypy passes with wrapt installed #21989.TYPE_CHECKINGblock falls back to a module__getattr__, so a missing name is typedAnyinstead of failing.compatlackedsingledispatchmethod, which madesymbol_db's decorators untyped, and the coverage bridges declared nothing. Fixed here. Full mypy is clean on all 1243 files; the commit hooks alone miss this, because they only check staged files.🤖 Generated with Claude Code