-
Notifications
You must be signed in to change notification settings - Fork 20
fix: annotation compatibility with python 3.9 #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Change-Id: I73c387651d49aadf40fecd8a1971e6e3236f1241 Co-developed-by: Cursor <[email protected]>
Change-Id: Ic62aac75a4c2b208936fc39d65afc58b4b098ec9 Co-developed-by: Cursor <[email protected]>
Change-Id: I6faf10b234dfc7ea22bf3c15bfb308ffb37ad7c2 Co-developed-by: Cursor <[email protected]>
Change-Id: I9cd411b9d681b1b2fbaddfe17df1fc36df0c5c2c Co-developed-by: Cursor <[email protected]>
Change-Id: I703dc2e51251cbb4273133b91ad8097ae5b6895c Co-developed-by: Cursor <[email protected]>
Change-Id: I0d416d8396fb973e00d9f5d9a09eb39127b42158 Co-developed-by: Cursor <[email protected]>
Change-Id: I1b9f215831c67b8bd1ccb915b806a232b5e226b1 Co-developed-by: Cursor <[email protected]>
|
There is a type check failure to be fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds Python 3.9 compatibility by importing from __future__ import annotations in files that use the modern union type syntax (X | Y). This is necessary because Python 3.9 does not natively support the X | Y syntax for type unions without this future import - it was only introduced natively in Python 3.10. The import enables deferred evaluation of annotations, allowing the use of the modern syntax while maintaining backward compatibility.
- Adds
from __future__ import annotationsto 9 Python files across multiple instrumentation packages - Updates the CHANGELOG with the fix description
- Ensures consistency in import placement (first import after copyright header, before other imports)
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/generate_instrumentation_readme.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/conftest.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-mem0/src/opentelemetry/instrumentation/mem0/config.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/test_websocket.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/mcp_server.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/instrumentation/langchain/test_langchain_instrumentor.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_utils.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/capture_content.py | Adds future annotations import for Python 3.9 compatibility |
| instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py | Adds future annotations import for Python 3.9 compatibility |
| CHANGELOG-loongsuite.md | Documents the Python 3.9 compatibility fix (contains typo in PR title) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ### Fixed | ||
|
|
||
| - Add `from __future__ import annotations` to fix Python 3.9 compatibility for union type syntax (`X | Y`) |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in PR title: "compatiblitiy" should be "compatibility"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
It was introduce by the previous commits and is a problem from upstream. We can ignore the issue in this PR. |
Change-Id: I73c387651d49aadf40fecd8a1971e6e3236f1241
Co-developed-by: Cursor [email protected]
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.