[python] improved local development experience with dd-trace-py#5990
Merged
[python] improved local development experience with dd-trace-py#5990
Conversation
sabrenner
commented
Jan 9, 2026
Contributor
|
|
sabrenner
commented
Jan 9, 2026
…g/system-tests into sabrenner/better-python-local-dev
ncybul
reviewed
Jan 9, 2026
ncybul
left a comment
There was a problem hiding this comment.
Tested this out locally and everything works as expected. Will leave the approval for other reviewers with more context on the system test changes!
cbeauchesne
requested changes
Jan 12, 2026
Collaborator
cbeauchesne
left a comment
There was a problem hiding this comment.
Just added a blocking RC, to be able to discuss about the build script.
All the rest if good to me 😉
Contributor
Author
|
@cbeauchesne just updated the |
sabrenner
added a commit
to DataDog/dd-trace-py
that referenced
this pull request
Jan 12, 2026
## Description Updates the `testrunner` pyenv version to `v2.6.17`, which includes more recent python releases. This is needed for DataDog/system-tests#5990, which possibly requires building native extensions for Python 3.11.14. ## Testing Uncommented the `testrunner` dev block in `docker-compose.yml`, ran `docker compose build testrunner`, and then ran `scripts/ddtest`. Inside the shell, ran ``` pyenv local 3.11.14 pip install -e . ``` and verified that the relative native extensions were built (e.g. `ddtrace/internal/_encoding.cpython-311-aarch64-linux-gnu.so`) ## Risks None --------- Co-authored-by: Brett Langdon <brett.langdon@datadoghq.com>
cbeauchesne
approved these changes
Jan 12, 2026
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.
Motivation
Faster developer experience using local dd-trace-py for
PARAMETRICandINTEGRATION_FRAMEWORKSscenarios.The current options outlined in the binaries documentation mostly point to pre-building wheels or pointing to a pip installable that would be installed on ever run, which is potentially slow, and I couldn't seem to make work with either
utils/scripts/watch.sh ../dd-trace-py-ing my localdd-trace-pyclone.This PR looks to utilize
PYTHONPATHSSI-like injection to set theddtracedependency from the mounteddd-trace-py, which has been used in a previous legacy test harness successfully.Changes
Modifies the parametric and integration_frameworks scenarios to have their client servers use a
PYTHONPATHpointed to a volume-mounted referencedd-trace-py.The changes to make this possible are:
PARAMETRICandINTEGRATION_FRAMEWORKSscenarios to read from/binaries/python-load-from-localif it exists, and use that to mount a/volumes/dd-trace-pyand set aPYTHONPATHentry forddtraceto use that mounteddd-trace-py(this involved an underlying change to theDockerFixturesScenariobase classinstall_ddtrace.shto still installddtracefor additional prod dependencies (likeenvier, etc.). It seems that even if they are installed locally they are not properly mounted - probably because they are installed in a virtual environment for those working ondd-trace-py. Maybe there's a way to leverage that? Either way, installingddtracefrom PyPi doesn't take too long.ddtraceversion, so it can reference the correct installation ofddtrace.Testing
This is the method I used locally to verify these changes, for both scenarios. For both scenarios, add a
python-load-from-localfile underbinaries/whose contents are the relative path to your dd-trace-pyPARAMETRICa. Run the
utils/scripts/build_ddtrace_py_native.shfile if necessary (ifddtrace/internal/_encoding.cpython-311-aarch64-linux-gnu.soalready exists, this step is not needed)b. In your local dd-trace-py, add an early return for the
set_metricmethod (we're looking to break a test)c. Run this specific test
./run.sh PARAMETRIC -L python -vv tests/parametric/test_tracer.py::Test_Tracer::test_tracer_span_top_level_attributes, which tries to set a metric on the span.d. Confirm this test fails with the missing metric. Undoing the early return and re-running the test should restore it.
INTEGRATION_FRAMEWORKSa. Run the
utils/scripts/build_ddtrace_py_native.shfile if necessary (ifddtrace/internal/_encoding.cpython-311-aarch64-linux-gnu.soalready exists, this step is not needed)b. n your local dd-trace-py, add an early return for the
_llmobs_set_tags_from_embeddingmethod (we're looking to break a test)c. Run this specific test
./run.sh INTEGRATION_FRAMEWORKS -L python --weblog google_genai-py@latest -vv tests/integration_frameworks/llm/google_genai/test_google_genai_llmobs.py::TestGoogleGenAiEmbedContent::test_embed_content, which tries to set a metric on the span.d. Confirm this test fails with the missing metadata. Undoing the early return and re-running the test should restore it.
Workflow
🚀 Once your PR is reviewed and the CI green, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
tests/ormanifests/is modified ? I have the approval from R&P teambuild-XXX-imagelabel is present