Skip to content

feat: own the injector bootstrap sitecustomize script#33

Open
ocelotl wants to merge 1 commit into
mainfrom
move-sitecustomize-to-distro
Open

feat: own the injector bootstrap sitecustomize script#33
ocelotl wants to merge 1 commit into
mainfrom
move-sitecustomize-to-distro

Conversation

@ocelotl

@ocelotl ocelotl commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What

Moves the OpenTelemetry injector bootstrap script (sitecustomize.py) and its unit tests into this repository under bootstrap/, so the distribution owns the script that triggers loading it, instead of each consumer maintaining its own copy.

Why

Follow-up to the discussion on dash0hq/dash0-operator#1248: now that the operator's Python auto-instrumentation payload is the Dash0 distribution, the bootstrap script that loads it belongs with the distribution rather than in the operator repo.

Notes

  • The script is deliberately kept as a standalone, valid-Python-2.7+ file that is never imported by the 3.10+ dash0-opentelemetry-distro package. It must be able to run under a legacy interpreter and bail out gracefully (version check) rather than crash with a SyntaxError, so it is not baked into the wheel.
  • bootstrap/ is excluded from ruff — the UP/pyupgrade rules would rewrite its 2.7-compatible constructs (from __future__, .format()) into 3.x-only syntax. This mirrors how the vendored pyproto packages are excluded.
  • The moved unit tests (12 tests) run across the existing 3.10–3.13 matrix via a new step in the test CI job.
  • At runtime the script reads all-dependencies.txt from its own directory for the double-instrumentation conflict check; that file is generated by the consumer when it assembles the injected package tree and is not part of this repo.

Consumer follow-up

The Dash0 operator will copy bootstrap/sitecustomize.py out of the pinned distribution tarball instead of shipping its own copy (folded into dash0-operator#1248).

Move the OpenTelemetry injector bootstrap script (sitecustomize.py) and its
unit tests into the distribution under bootstrap/, so the distribution owns the
script that triggers loading it instead of each consumer maintaining a copy.

The script is kept as a standalone, valid-Python-2.7+ file that is never
imported by the 3.10+ distribution package, so it can detect and bail out
gracefully on legacy interpreters. bootstrap/ is excluded from ruff (its
pyupgrade rules would rewrite the 2.7-compatible syntax) and its tests run
across the existing Python matrix in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant