diff --git a/pyproject.toml b/pyproject.toml index c6ae83f..337095e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = {file = "LICENSE"} dynamic = ["version", "description"] dependencies = [ "ipywidgets", - "typing_extensions >= 4.1.1", + "typing_extensions >= 3.7.0", ] classifiers = [ diff --git a/reacton/core.py b/reacton/core.py index ac54e1a..650c65f 100644 --- a/reacton/core.py +++ b/reacton/core.py @@ -40,7 +40,6 @@ import ipywidgets import ipywidgets as widgets import traitlets -import typing_extensions from typing_extensions import Literal, Protocol import reacton.logging # noqa: F401 # has sidefx @@ -87,7 +86,12 @@ def get(): V = TypeVar("V") # used for value type of widget V2 = TypeVar("V2") # used for value type of widget E = TypeVar("E") # used for elements -P = typing_extensions.ParamSpec("P") + +try: + from typing_extensions import ParamSpec + P = ParamSpec("P") +except ImportError: + P = ... WidgetOrList = Union[widgets.Widget, List[widgets.Widget]] EffectCleanupCallable = Callable[[], None] diff --git a/reacton/utils.py b/reacton/utils.py index f11c0d3..7c2f6ca 100644 --- a/reacton/utils.py +++ b/reacton/utils.py @@ -6,9 +6,13 @@ from typing import Callable, TypeVar, cast import ipywidgets as widgets -import typing_extensions -P = typing_extensions.ParamSpec("P") +try: + from typing_extensions import ParamSpec + P = ParamSpec("P") +except ImportError: + P = ... + T = TypeVar("T")