Skip to content

Declare requests as an install dependency for telemetry - #2693

Open
Bhaskar Gurram (bhaskargurram-ai) wants to merge 1 commit into
microsoft:mainfrom
bhaskargurram-ai:fix/telemetry-requests-dependency
Open

Bhaskar Gurram (bhaskargurram-ai) wants to merge 1 commit into
microsoft:mainfrom
bhaskargurram-ai:fix/telemetry-requests-dependency

Conversation

@bhaskargurram-ai

Copy link
Copy Markdown

import olive imports olive.telemetry, whose OneCollector exporter (olive/telemetry/library/exporter.py, options.py, transport.py) imports requests at module level. requests was never listed in requirements.txt, so it only ended up installed as a transitive dependency of transformers/huggingface_hub. Newer releases of those packages no longer depend on requests, so a fresh pip install olive-ai (no extras) fails with
ModuleNotFoundError: No module named 'requests' on import olive.

Telemetry is a core, always-on component (its other dependency, opentelemetry-sdk, is already a hard requirement and the exporter's public API is typed around requests.Session), so declare requests in requirements.txt rather than making the import optional.

Add a test that statically checks every unconditional third-party import under olive/telemetry maps to a distribution declared in requirements.txt, so a future telemetry dependency cannot silently break import olive again.

Describe your changes

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

(Optional) Issue link

`import olive` imports `olive.telemetry`, whose OneCollector exporter
(`olive/telemetry/library/exporter.py`, `options.py`, `transport.py`)
imports `requests` at module level. `requests` was never listed in
`requirements.txt`, so it only ended up installed as a transitive
dependency of `transformers`/`huggingface_hub`. Newer releases of those
packages no longer depend on `requests`, so a fresh
`pip install olive-ai` (no extras) fails with
`ModuleNotFoundError: No module named 'requests'` on `import olive`.

Telemetry is a core, always-on component (its other dependency,
`opentelemetry-sdk`, is already a hard requirement and the exporter's
public API is typed around `requests.Session`), so declare `requests` in
`requirements.txt` rather than making the import optional.

Add a test that statically checks every unconditional third-party import
under `olive/telemetry` maps to a distribution declared in
`requirements.txt`, so a future telemetry dependency cannot silently
break `import olive` again.
Copilot AI lite review requested due to automatic review settings September 26, 2026 20:04
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The dependency guard cannot execute when requests is missing because test collection imports telemetry first.

Review effort: Lite
Findings: None

What changed in this PR

Adds requests as a core dependency and introduces a static guard for telemetry imports.

Changes:

  • Declares requests in requirements.txt.
  • Adds telemetry dependency validation.
  • Initializes the telemetry test package.
File Summary
test/​telemetry/​test_dependencies.py Validates declared telemetry dependencies; test setup needs isolation from telemetry imports.
test/​telemetry/​__init__.py Initializes the telemetry test package.
requirements.txt Adds requests as an install dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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.

2 participants