diff --git a/CHANGELOG-loongsuite.md b/CHANGELOG-loongsuite.md index 2795145f0..55e6bffd6 100644 --- a/CHANGELOG-loongsuite.md +++ b/CHANGELOG-loongsuite.md @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +- Add `from __future__ import annotations` to fix Python 3.9 compatibility for union type syntax (`X | Y`) + ([#80](https://github.com/alibaba/loongsuite-python-agent/pull/80)) + # Added - `loongsuite-instrumentation-mem0`: add support for mem0 diff --git a/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py b/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py index 82dda55d1..20e90d675 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py +++ b/instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # pylint: disable=too-many-lines +from __future__ import annotations import copy import dataclasses diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/capture_content.py b/instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/capture_content.py index 0d71b5002..bdf11d49e 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/capture_content.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/capture_content.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from opentelemetry import trace as trace_api from opentelemetry.instrumentation.dify.env_utils import ( is_capture_content_enabled, diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_utils.py b/instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_utils.py index 3111e71ea..dc1c06146 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_utils.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_utils.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import ast import logging import sys diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/instrumentation/langchain/test_langchain_instrumentor.py b/instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/instrumentation/langchain/test_langchain_instrumentor.py index 58b150b95..a31f42831 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/instrumentation/langchain/test_langchain_instrumentor.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/instrumentation/langchain/test_langchain_instrumentor.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import asyncio import json import logging diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/mcp_server.py b/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/mcp_server.py index 5f036580d..77d466be3 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/mcp_server.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/mcp_server.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import sys from opentelemetry import trace diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/test_websocket.py b/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/test_websocket.py index faaf3f854..be8f4c8f6 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/test_websocket.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/test_websocket.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import asyncio import multiprocessing import socket diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-mem0/src/opentelemetry/instrumentation/mem0/config.py b/instrumentation-loongsuite/loongsuite-instrumentation-mem0/src/opentelemetry/instrumentation/mem0/config.py index 3e2a8a0ec..c5363e1b3 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-mem0/src/opentelemetry/instrumentation/mem0/config.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-mem0/src/opentelemetry/instrumentation/mem0/config.py @@ -2,6 +2,8 @@ Configuration for Mem0 instrumentation. """ +from __future__ import annotations + import os from dataclasses import dataclass from typing import Optional diff --git a/instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/conftest.py b/instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/conftest.py index 08acdbe6a..90e9d0933 100644 --- a/instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/conftest.py +++ b/instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/conftest.py @@ -4,6 +4,8 @@ Provides OTel exporters, VCR configuration, and convenient instrumentor fixtures. """ +from __future__ import annotations + import json import os diff --git a/scripts/generate_instrumentation_readme.py b/scripts/generate_instrumentation_readme.py index 0148480ff..ad0e07e78 100755 --- a/scripts/generate_instrumentation_readme.py +++ b/scripts/generate_instrumentation_readme.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations + import logging import os