Skip to content

Remove packaging runtime dependency from SQLAlchemy instrumentation - #4915

Open
saisharan0103 wants to merge 1 commit into
open-telemetry:mainfrom
saisharan0103:mergepath/issue-4887-remove-packaging-as-a-runtime-dependency
Open

Remove packaging runtime dependency from SQLAlchemy instrumentation#4915
saisharan0103 wants to merge 1 commit into
open-telemetry:mainfrom
saisharan0103:mergepath/issue-4887-remove-packaging-as-a-runtime-dependency

Conversation

@saisharan0103

Copy link
Copy Markdown

Removes the direct packaging >= 21.0 runtime dependency from opentelemetry-instrumentation-sqlalchemy.

The dependency was only needed because SQLAlchemy instrumentation imported packaging.version.parse to compare sqlalchemy.__version__ against 1.4 before installing or removing SQLAlchemy 1.4+ wrappers. This forced the auto-instrumentation injector to add packaging to the target application's PYTHONPATH, even though PEP 440 version parsing is already intended to come from opentelemetry-instrumentation after #4882.

This changes the SQLAlchemy instrumentation module to use Version from opentelemetry.instrumentation._packaging.version and compare Version(sqlalchemy.__version__).release to (1, 4) at the existing four version-gated call sites.

A focused regression test now asserts that the SQLAlchemy instrumentation package metadata no longer lists packaging as a direct runtime dependency. The existing SQLAlchemy 1.4/2.x tox variants continue to cover the version-gated wrapper behavior.

Fixes #4887

ruff check instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/__init__.py instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py reports no new findings on the changed files.
Ran pytest -x locally with no new failures.

…pendency of `opentelemetry-instrumentation-sqlalchemy`

Closes open-telemetry#4887
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ❌ The email address for the commit (49f02d4) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

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-sqlalchemy

1 participant