diff --git a/pyproject.toml b/pyproject.toml index 642b559..613161a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dask = {version = "^2024.5.0", optional = true, extras = ["testing"]} distributed = {version = "^2024.5.0", optional = true, extras = ["testing"]} cacheout = "^0.16.0" arcae = "^0.2.4" +typing-extensions = { version = "^4.12.2", python = "<3.11" } [tool.poetry.extras] testing = ["dask", "distributed", "pytest"] diff --git a/xarray_ms/backend/msv2/encoders.py b/xarray_ms/backend/msv2/encoders.py index cb24f59..fac345c 100644 --- a/xarray_ms/backend/msv2/encoders.py +++ b/xarray_ms/backend/msv2/encoders.py @@ -13,8 +13,16 @@ from __future__ import annotations +import sys from datetime import datetime -from typing import TYPE_CHECKING, Any, Dict, List, Self +from typing import TYPE_CHECKING, Any, Dict, List + +if TYPE_CHECKING: + if sys.version_info >= (3, 11): + from typing import Self + else: + from typing_extensions import Self + import numpy as np import numpy.testing as npt