Skip to content

Commit 565e071

Browse files
committed
Fix Python <3.10 compat. issue with ParamSpec import
1 parent b92a9d8 commit 565e071

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

sigima_/computation/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,16 @@
9898
import inspect
9999
import os.path as osp
100100
import pkgutil
101+
import sys
101102
from types import ModuleType
102-
from typing import Callable, Optional, ParamSpec, TypeVar
103+
from typing import Callable, Optional, TypeVar
104+
105+
if sys.version_info >= (3, 10):
106+
# Use ParamSpec from typing module in Python 3.10+
107+
from typing import ParamSpec
108+
else:
109+
# Use ParamSpec from typing_extensions module in Python < 3.10
110+
from typing_extensions import ParamSpec
103111

104112
# Marker attribute used by @computation_function and introspection
105113
COMPUTATION_METADATA_ATTR = "__computation_function_metadata"

0 commit comments

Comments
 (0)