Skip to content

Commit efc992c

Browse files
authored
Fix annotation compatibility with python 3.9 (#80)
fix: annotation compatibility with python 3.9
2 parents 0d1e1c1 + f207464 commit efc992c

File tree

10 files changed

+22
-1
lines changed

10 files changed

+22
-1
lines changed

CHANGELOG-loongsuite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212
## Unreleased
1313

14+
### Fixed
15+
16+
- Add `from __future__ import annotations` to fix Python 3.9 compatibility for union type syntax (`X | Y`)
17+
([#80](https://github.com/alibaba/loongsuite-python-agent/pull/80))
18+
1419
# Added
1520

1621
- `loongsuite-instrumentation-mem0`: add support for mem0

instrumentation-genai/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
# pylint: disable=too-many-lines
15+
from __future__ import annotations
1516

1617
import copy
1718
import dataclasses

instrumentation-loongsuite/loongsuite-instrumentation-dify/src/opentelemetry/instrumentation/dify/capture_content.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from opentelemetry import trace as trace_api
24
from opentelemetry.instrumentation.dify.env_utils import (
35
is_capture_content_enabled,

instrumentation-loongsuite/loongsuite-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/internal/_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import ast
24
import logging
35
import sys

instrumentation-loongsuite/loongsuite-instrumentation-langchain/tests/instrumentation/langchain/test_langchain_instrumentor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import json
35
import logging

instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/mcp_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import sys
24

35
from opentelemetry import trace

instrumentation-loongsuite/loongsuite-instrumentation-mcp/tests/test_websocket.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
import asyncio
24
import multiprocessing
35
import socket

instrumentation-loongsuite/loongsuite-instrumentation-mem0/src/opentelemetry/instrumentation/mem0/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Configuration for Mem0 instrumentation.
33
"""
44

5+
from __future__ import annotations
6+
57
import os
68
from dataclasses import dataclass
79
from typing import Optional

instrumentation-loongsuite/loongsuite-instrumentation-mem0/tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Provides OTel exporters, VCR configuration, and convenient instrumentor fixtures.
55
"""
66

7+
from __future__ import annotations
8+
79
import json
810
import os
911

scripts/generate_instrumentation_readme.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
32
# Copyright The OpenTelemetry Authors
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +13,8 @@
1413
# See the License for the specific language governing permissions and
1514
# limitations under the License.
1615

16+
from __future__ import annotations
17+
1718
import logging
1819
import os
1920

0 commit comments

Comments
 (0)