open-telemetry / open-telemetry/opentelemetry-python-contrib

Remove `packaging` as a runtime dependency of `opentelemetry-instrumentation-pika`

Open Beginner friendly
#4,886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Remove packaging as a runtime dependency of opentelemetry-instrumentation-pika

Summary

opentelemetry-instrumentation-pika declares packaging >= 20.0 as a runtime
dependency, used solely to compare the installed pika version.

Motivation: the auto-instrumentation injector

The auto-instrumentation injector (the Python auto-instrumentation shipped by the
OpenTelemetry Operator) bundles the instrumentation packages and all of their
runtime dependencies
into an init container and prepends that directory to the
target application's PYTHONPATH. Every runtime dependency is therefore injected
into the user's application process, where a common library like packaging
risks version shadowing/conflicts and adds to the injected payload. Removing it
shrinks that footprint. See #4882 for the full rationale.

Where it is used

  • pyproject.toml: packaging >= 20.0 in dependencies.
  • src/opentelemetry/instrumentation/pika/pika_instrumentor.py:34:
    version.parse(pika.__version__) compared against 1.0.0 to select the
    correct instrumentation hook.

Purpose: spec-compliant PEP 440 ordering of pika.__version__ to branch
behavior by installed pika version.

Proposed resolution

Import the PEP 440 Version from the internal implementation added in #4882
(opentelemetry.instrumentation._packaging.version) instead of packaging, and
remove packaging from this package's dependencies.

Depends on #4882, which introduces opentelemetry.instrumentation._packaging
in opentelemetry-instrumentation (a dependency of this package).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect pyproject.toml and src/opentelemetry/instrumentation/pika/pika_instrumentor.py:34, then read the internal packaging implementation introduced by #4882. Replace the external dependency usage with that implementation and remove packaging from the runtime dependencies; done means the version comparison remains PEP 440-compliant without packaging being declared.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.