Add deprecated marker from either typing or typing_extensions based on the python version
diff --git a/python/datafusion/context.py b/python/datafusion/context.py index 864ef1c..c651f90 100644 --- a/python/datafusion/context.py +++ b/python/datafusion/context.py
@@ -21,7 +21,10 @@ from typing import TYPE_CHECKING, Any, Protocol -from typing_extensions import deprecated +try: + from typing import deprecated # Python 3.13+ +except ImportError: + from typing_extensions import deprecated # Python 3.12 from datafusion.catalog import Catalog, Table from datafusion.dataframe import DataFrame
diff --git a/python/datafusion/dataframe.py b/python/datafusion/dataframe.py index 7413a5f..21b82b1 100644 --- a/python/datafusion/dataframe.py +++ b/python/datafusion/dataframe.py
@@ -33,7 +33,10 @@ overload, ) -from typing_extensions import deprecated +try: + from typing import deprecated # Python 3.13+ +except ImportError: + from typing_extensions import deprecated # Python 3.12 from datafusion.plan import ExecutionPlan, LogicalPlan from datafusion.record_batch import RecordBatchStream
diff --git a/python/datafusion/expr.py b/python/datafusion/expr.py index 68ddd7c..dcafa42 100644 --- a/python/datafusion/expr.py +++ b/python/datafusion/expr.py
@@ -25,7 +25,11 @@ from typing import TYPE_CHECKING, Any, Optional, Type import pyarrow as pa -from typing_extensions import deprecated + +try: + from typing import deprecated # Python 3.13+ +except ImportError: + from typing_extensions import deprecated # Python 3.12 from datafusion.common import DataTypeMap, NullTreatment, RexType
diff --git a/python/datafusion/substrait.py b/python/datafusion/substrait.py index 402184d..4553d23 100644 --- a/python/datafusion/substrait.py +++ b/python/datafusion/substrait.py
@@ -26,7 +26,10 @@ import pathlib from typing import TYPE_CHECKING -from typing_extensions import deprecated +try: + from typing import deprecated # Python 3.13+ +except ImportError: + from typing_extensions import deprecated # Python 3.12 from datafusion.plan import LogicalPlan