Skip to content

Remove packaging as a runtime dependency of opentelemetry-instrumentation - #4883

Open
ocelotl wants to merge 2 commits into
open-telemetry:mainfrom
ocelotl:issue_4882_remove_packaging_dependency
Open

Remove packaging as a runtime dependency of opentelemetry-instrumentation#4883
ocelotl wants to merge 2 commits into
open-telemetry:mainfrom
ocelotl:issue_4882_remove_packaging_dependency

Conversation

@ocelotl

@ocelotl ocelotl commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

Removes packaging as a runtime dependency of opentelemetry-instrumentation,
replacing its use with a small internal implementation under
opentelemetry.instrumentation._packaging:

  • PEP 440 Version (parsing, normalization, ordering) for the schema-version
    comparison in _semconv.py.
  • PEP 508 Requirement parsing plus PEP 440 specifier containment and marker
    evaluation for the dependency-conflict machinery in dependencies.py and
    bootstrap.py.

packaging is dropped from opentelemetry-instrumentation's dependencies.

Motivation: the auto-instrumentation injector ships instrumentation and its
runtime dependencies onto the target application's PYTHONPATH, so every runtime
dependency (like packaging) is injected into the user's process and risks
version shadowing/conflicts. See the issue for details.

The same removal for the four instrumentations that depend on packaging
(falcon #4884, flask #4885, pika #4886, sqlalchemy #4887) is handled in separate
PRs that reuse the internal implementation introduced here.

Fixes #4882

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • New unit tests for the internal version, specifiers, requirements and markers
    modules (tests/test_packaging_*.py).
  • The internal implementation was validated against packaging across a broad
    corpus of PEP 440 versions and specifiers (parsing, normalization, attributes
    and ordering) with no divergence.
  • Existing test_dependencies.py continues to pass against the internal
    implementation.

Does This PR Require a Core Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@ocelotl
ocelotl force-pushed the issue_4882_remove_packaging_dependency branch from d009c76 to d13f378 Compare July 28, 2026 22:23
@ocelotl ocelotl changed the title Remove packaging as a runtime dependency of the instrumentation packages Remove packaging as a runtime dependency of opentelemetry-instrumentation Jul 28, 2026
@ocelotl
ocelotl force-pushed the issue_4882_remove_packaging_dependency branch 3 times, most recently from 476387a to 6de1be6 Compare July 28, 2026 23:10
@ocelotl
ocelotl marked this pull request as ready for review July 28, 2026 23:14
@ocelotl
ocelotl requested a review from a team as a code owner July 28, 2026 23:14
ocelotl added 2 commits July 28, 2026 18:23
Adds opentelemetry.instrumentation._packaging with PEP 440 Version and PEP 508
Requirement/specifier/marker support, implementing the subset of packaging used
by opentelemetry-instrumentation. Behaviour was validated against packaging
across a large corpus of version/specifier/marker/requirement inputs.
Points _semconv (version comparison) and dependencies.py/bootstrap.py
(requirement parsing) at opentelemetry.instrumentation._packaging, removes
packaging from opentelemetry-instrumentation's runtime dependencies and
refreshes uv.lock.
@ocelotl
ocelotl force-pushed the issue_4882_remove_packaging_dependency branch from 6de1be6 to ebabae2 Compare July 28, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Remove packaging as a runtime dependency of opentelemetry-instrumentation

1 participant