Declare requests as an install dependency for telemetry - #2693
Open
Bhaskar Gurram (bhaskargurram-ai) wants to merge 1 commit into
Open
Bhaskar Gurram (bhaskargurram-ai) wants to merge 1 commit into
Bhaskar Gurram (bhaskargurram-ai) wants to merge 1 commit into
Conversation
`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.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Bhaskar Gurram (bhaskargurram-ai)
September 26, 2026 20:05
View session
Contributor
There was a problem hiding this comment.
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
requestsinrequirements.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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
import oliveimportsolive.telemetry, whose OneCollector exporter (olive/telemetry/library/exporter.py,options.py,transport.py) importsrequestsat module level.requestswas never listed inrequirements.txt, so it only ended up installed as a transitive dependency oftransformers/huggingface_hub. Newer releases of those packages no longer depend onrequests, so a freshpip install olive-ai(no extras) fails withModuleNotFoundError: No module named 'requests'onimport 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 aroundrequests.Session), so declarerequestsinrequirements.txtrather than making the import optional.Add a test that statically checks every unconditional third-party import under
olive/telemetrymaps to a distribution declared inrequirements.txt, so a future telemetry dependency cannot silently breakimport oliveagain.Describe your changes
Checklist before requesting a review
lintrunner -a(Optional) Issue link