Repository: theislab/cellrank (language: python)

Issue:
Deprecate Python 3.7 support
## Description

Given that Python 3.7 is, by now, quite old, we should we no longer support it. We also discussed this at some point.


Discussion / hints:

Fix patch:
diff --git a/cellrank/__init__.py b/cellrank/__init__.py
index 0e18fb856..ab2d31824 100644
--- a/cellrank/__init__.py
+++ b/cellrank/__init__.py
@@ -7,12 +7,8 @@
 __version__ = "1.5.1"
 __email__ = "info@cellrank.org"
 
-try:
-    from importlib_metadata import version  # Python < 3.8
-except ImportError:
-    from importlib.metadata import version  # Python = 3.8
-
 from packaging.version import parse
+from importlib.metadata import version
 
 try:
     __full_version__ = parse(version(__name__))
diff --git a/cellrank/_utils/_enum.py b/cellrank/_utils/_enum.py
index f4c02ce03..9da9b755b 100644
--- a/cellrank/_utils/_enum.py
+++ b/cellrank/_utils/_enum.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, Type, Tuple, Callable
-from typing_extensions import Literal
+from typing import Any, Dict, Type, Tuple, Literal, Callable
 
 from abc import ABC, ABCMeta
 from enum import Enum, EnumMeta
diff --git a/cellrank/_utils/_lineage.py b/cellrank/_utils/_lineage.py
index 997cf2d2b..cab82b64f 100644
--- a/cellrank/_utils/_lineage.py
+++ b/cellrank/_utils/_lineage.py
@@ -3,13 +3,13 @@
     List,
     Tuple,
     Union,
+    Literal,
     Mapping,
     TypeVar,
     Callable,
     Iterable,
     Optional,
 )
-from typing_extensions import Literal
 
 from copy import copy as copy_
 from enum import auto
diff --git a/cellrank/_utils/_utils.py b/cellrank/_utils/_utils.py
index ebc780f49..c521c2138 100644
--- a/cellrank/_utils/_utils.py
+++ b/cellrank/_utils/_utils.py
@@ -4,6 +4,7 @@
     List,
     Tuple,
     Union,
+    Literal,
     TypeVar,
     Callable,
     Hashable,
@@ -11,7 +12,6 @@
     Optional,
     Sequence,
 )
-from typing_extensions import Literal
 
 import os
 import wrapt
diff --git a/cellrank/datasets/_datasets.py b/cellrank/datasets/_datasets.py
index 2407a3736..539eedee4 100644
--- a/cellrank/datasets/_datasets.py
+++ b/cellrank/datasets/_datasets.py
@@ -1,5 +1,4 @@
-from typing import Any, Tuple, Union
-from typing_extensions import Literal
+from typing import Any, Tuple, Union, Literal
 
 import os
 from enum import auto
diff --git a/cellrank/estimators/_base_estimator.py b/cellrank/estimators/_base_estimator.py
index 116f21a14..7f1dbc997 100644
--- a/cellrank/estimators/_base_estimator.py
+++ b/cellrank/estimators/_base_estimator.py
@@ -1,5 +1,15 @@
-from typing import Any, Dict, List, Tuple, Union, Mapping, Callable, Optional, Sequence
-from typing_extensions import Literal
+from typing import (
+    Any,
+    Dict,
+    List,
+    Tuple,
+    Union,
+    Literal,
+    Mapping,
+    Callable,
+    Optional,
+    Sequence,
+)
 
 from abc import ABC, abstractmethod
 from copy import copy as copy_
diff --git a/cellrank/estimators/mixins/_absorption_probabilities.py b/cellrank/estimators/mixins/_absorption_probabilities.py
index aaa173044..37e1d2ff8 100644
--- a/cellrank/estimators/mixins/_absorption_probabilities.py
+++ b/cellrank/estimators/mixins/_absorption_probabilities.py
@@ -1,5 +1,14 @@
-from typing import Any, Dict, Tuple, Union, Mapping, Optional, Sequence, NamedTuple
-from typing_extensions import Literal
+from typing import (
+    Any,
+    Dict,
+    Tuple,
+    Union,
+    Literal,
+    Mapping,
+    Optional,
+    Sequence,
+    NamedTuple,
+)
 
 from types import MappingProxyType
 
diff --git a/cellrank/estimators/mixins/_lineage_drivers.py b/cellrank/estimators/mixins/_lineage_drivers.py
index 7882e7754..1f245ac2c 100644
--- a/cellrank/estimators/mixins/_lineage_drivers.py
+++ b/cellrank/estimators/mixins/_lineage_drivers.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, Tuple, Union, Mapping, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Dict, Tuple, Union, Literal, Mapping, Optional, Sequence
 
 from types import MappingProxyType
 from pathlib import Path
diff --git a/cellrank/estimators/mixins/_utils.py b/cellrank/estimators/mixins/_utils.py
index 22d2c846b..5f02d5d66 100644
--- a/cellrank/estimators/mixins/_utils.py
+++ b/cellrank/estimators/mixins/_utils.py
@@ -3,14 +3,15 @@
     Dict,
     Tuple,
     Union,
+    Literal,
     Mapping,
     TypeVar,
     Callable,
     Iterable,
     Optional,
+    Protocol,
     Sequence,
 )
-from typing_extensions import Literal, Protocol
 
 from copy import copy, deepcopy
 from enum import auto
diff --git a/cellrank/estimators/mixins/decomposition/_eigen.py b/cellrank/estimators/mixins/decomposition/_eigen.py
index 4a701f091..91d33c2a6 100644
--- a/cellrank/estimators/mixins/decomposition/_eigen.py
+++ b/cellrank/estimators/mixins/decomposition/_eigen.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, Tuple, Union, Mapping, Optional
-from typing_extensions import Literal
+from typing import Any, Dict, Tuple, Union, Literal, Mapping, Optional
 
 from types import MappingProxyType
 from pathlib import Path
diff --git a/cellrank/estimators/mixins/decomposition/_schur.py b/cellrank/estimators/mixins/decomposition/_schur.py
index 6499698a0..5fbb6c296 100644
--- a/cellrank/estimators/mixins/decomposition/_schur.py
+++ b/cellrank/estimators/mixins/decomposition/_schur.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, Tuple, Union, Mapping, Optional
-from typing_extensions import Literal
+from typing import Any, Dict, Tuple, Union, Literal, Mapping, Optional
 
 import io
 import contextlib
diff --git a/cellrank/estimators/terminal_states/_cflare.py b/cellrank/estimators/terminal_states/_cflare.py
index e791afc5d..0154a9ee5 100644
--- a/cellrank/estimators/terminal_states/_cflare.py
+++ b/cellrank/estimators/terminal_states/_cflare.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, List, Union, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Dict, List, Union, Literal, Optional, Sequence
 
 from anndata import AnnData
 from cellrank import logging as logg
diff --git a/cellrank/estimators/terminal_states/_gpcca.py b/cellrank/estimators/terminal_states/_gpcca.py
index c0dba13a0..ecbdba4f4 100644
--- a/cellrank/estimators/terminal_states/_gpcca.py
+++ b/cellrank/estimators/terminal_states/_gpcca.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, Tuple, Union, Mapping, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Dict, Tuple, Union, Literal, Mapping, Optional, Sequence
 
 from enum import auto
 from types import MappingProxyType
diff --git a/cellrank/external/kernels/_statot_kernel.py b/cellrank/external/kernels/_statot_kernel.py
index 1dda8485c..6020e2375 100644
--- a/cellrank/external/kernels/_statot_kernel.py
+++ b/cellrank/external/kernels/_statot_kernel.py
@@ -1,5 +1,4 @@
-from typing import Any, Union, Optional
-from typing_extensions import Literal
+from typing import Any, Union, Literal, Optional
 
 from anndata import AnnData
 from cellrank._utils._key import Key
diff --git a/cellrank/external/kernels/_utils.py b/cellrank/external/kernels/_utils.py
index e30d9ce18..5070ccf1e 100644
--- a/cellrank/external/kernels/_utils.py
+++ b/cellrank/external/kernels/_utils.py
@@ -1,5 +1,4 @@
-from typing import Mapping, Sequence
-from typing_extensions import Literal
+from typing import Literal, Mapping, Sequence
 
 __all__ = ["MarkerGenes"]
 
diff --git a/cellrank/external/kernels/_wot_kernel.py b/cellrank/external/kernels/_wot_kernel.py
index 3c940666a..550862af2 100644
--- a/cellrank/external/kernels/_wot_kernel.py
+++ b/cellrank/external/kernels/_wot_kernel.py
@@ -1,5 +1,4 @@
-from typing import Any, Union, Mapping, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Union, Literal, Mapping, Optional, Sequence
 
 from types import MappingProxyType
 
diff --git a/cellrank/kernels/_cytotrace_kernel.py b/cellrank/kernels/_cytotrace_kernel.py
index 809956633..885dc5644 100644
--- a/cellrank/kernels/_cytotrace_kernel.py
+++ b/cellrank/kernels/_cytotrace_kernel.py
@@ -1,5 +1,4 @@
-from typing import Any, List, Tuple, Optional
-from typing_extensions import Literal
+from typing import Any, List, Tuple, Literal, Optional
 
 from enum import auto
 
diff --git a/cellrank/kernels/_pseudotime_kernel.py b/cellrank/kernels/_pseudotime_kernel.py
index 1fd72b6e9..20dc755fd 100644
--- a/cellrank/kernels/_pseudotime_kernel.py
+++ b/cellrank/kernels/_pseudotime_kernel.py
@@ -1,5 +1,4 @@
-from typing import Any, Union, Callable, Optional
-from typing_extensions import Literal
+from typing import Any, Union, Literal, Callable, Optional
 
 from enum import auto
 
diff --git a/cellrank/kernels/_transport_map_kernel.py b/cellrank/kernels/_transport_map_kernel.py
index bfb3b9f61..e2d1d92b6 100644
--- a/cellrank/kernels/_transport_map_kernel.py
+++ b/cellrank/kernels/_transport_map_kernel.py
@@ -1,5 +1,14 @@
-from typing import Any, Dict, Tuple, Union, Mapping, Iterable, Optional, Sequence
-from typing_extensions import Literal
+from typing import (
+    Any,
+    Dict,
+    Tuple,
+    Union,
+    Literal,
+    Mapping,
+    Iterable,
+    Optional,
+    Sequence,
+)
 
 from abc import ABC, abstractmethod
 from types import MappingProxyType
diff --git a/cellrank/kernels/_velocity_kernel.py b/cellrank/kernels/_velocity_kernel.py
index 912c7de13..6960ddc44 100644
--- a/cellrank/kernels/_velocity_kernel.py
+++ b/cellrank/kernels/_velocity_kernel.py
@@ -1,5 +1,4 @@
-from typing import Any, Tuple, Union, Callable, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Tuple, Union, Literal, Callable, Optional, Sequence
 
 from anndata import AnnData
 from cellrank import logging as logg
diff --git a/cellrank/kernels/mixins/_io.py b/cellrank/kernels/mixins/_io.py
index 38616fd98..5ad05cbfd 100644
--- a/cellrank/kernels/mixins/_io.py
+++ b/cellrank/kernels/mixins/_io.py
@@ -1,5 +1,4 @@
-from typing import Any, Tuple, Union, Optional
-from typing_extensions import Protocol
+from typing import Any, Tuple, Union, Optional, Protocol
 
 import pickle
 from pathlib import Path
diff --git a/cellrank/kernels/utils/_random_walk.py b/cellrank/kernels/utils/_random_walk.py
index 3b8e8ce7a..0e0a2b17e 100644
--- a/cellrank/kernels/utils/_random_walk.py
+++ b/cellrank/kernels/utils/_random_walk.py
@@ -1,5 +1,4 @@
-from typing import Any, List, Tuple, Union, Mapping, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, List, Tuple, Union, Literal, Mapping, Optional, Sequence
 
 from pathlib import Path
 from itertools import chain
diff --git a/cellrank/models/_gamr_model.py b/cellrank/models/_gamr_model.py
index a4bf6a987..b8eeff15a 100644
--- a/cellrank/models/_gamr_model.py
+++ b/cellrank/models/_gamr_model.py
@@ -1,5 +1,4 @@
-from typing import Any, Tuple, Union, Optional
-from typing_extensions import Literal
+from typing import Any, Tuple, Union, Literal, Optional
 
 from copy import copy, deepcopy
 from enum import auto
diff --git a/cellrank/models/_pygam_model.py b/cellrank/models/_pygam_model.py
index 627651a70..1278d63d8 100644
--- a/cellrank/models/_pygam_model.py
+++ b/cellrank/models/_pygam_model.py
@@ -1,5 +1,4 @@
-from typing import Any, Union, Mapping, Optional
-from typing_extensions import Literal
+from typing import Any, Union, Literal, Mapping, Optional
 
 import warnings
 from copy import copy as _copy
diff --git a/cellrank/pl/_aggregate_abs_probs.py b/cellrank/pl/_aggregate_abs_probs.py
index 09533b2ce..320893fc1 100644
--- a/cellrank/pl/_aggregate_abs_probs.py
+++ b/cellrank/pl/_aggregate_abs_probs.py
@@ -1,5 +1,4 @@
-from typing import Any, Tuple, Union, Mapping, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Tuple, Union, Literal, Mapping, Optional, Sequence
 
 import math
 from enum import auto
diff --git a/cellrank/pl/_circular_projection.py b/cellrank/pl/_circular_projection.py
index e84b3fdad..f9680c4d6 100644
--- a/cellrank/pl/_circular_projection.py
+++ b/cellrank/pl/_circular_projection.py
@@ -1,5 +1,4 @@
-from typing import Any, Tuple, Union, Mapping, Callable, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Tuple, Union, Literal, Mapping, Callable, Optional, Sequence
 
 from enum import auto
 from types import MappingProxyType
diff --git a/cellrank/pl/_heatmap.py b/cellrank/pl/_heatmap.py
index 0748d928c..f6e68a17b 100644
--- a/cellrank/pl/_heatmap.py
+++ b/cellrank/pl/_heatmap.py
@@ -1,5 +1,4 @@
-from typing import Any, Dict, List, Tuple, Union, Optional, Sequence
-from typing_extensions import Literal
+from typing import Any, Dict, List, Tuple, Union, Literal, Optional, Sequence
 
 import os
 from enum import auto
diff --git a/pyproject.toml b/pyproject.toml
index 63ba94ad6..7711d33b0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -33,7 +33,7 @@ line_length = 88
 multi_line_output = 3
 include_trailing_comma = true
 use_parentheses = true
-known_stdlib = "typing,typing_extensions"
+known_stdlib = "typing"
 known_bio = "scanpy,cellrank,scvelo,anndata"
 known_plot = "mpl_toolkits,matplotlib,seaborn"
 known_num = "numpy,numba,pandas,scipy,sklearn,statmodels,networkx,pygam"
diff --git a/requirements.txt b/requirements.txt
index 432616ff7..4a0feb998 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,5 +14,4 @@ scipy>=1.2.0
 scvelo>=0.2.4
 seaborn>=0.10.0
 setuptools>=41.0.1
-typing_extensions
 wrapt>=1.12.1
diff --git a/setup.py b/setup.py
index 8a4976747..94778fdfe 100644
--- a/setup.py
+++ b/setup.py
@@ -86,7 +86,6 @@
             "Operating System :: Microsoft :: Windows",
             "Typing :: Typed",
             "Programming Language :: Python :: 3",
-            "Programming Language :: Python :: 3.7",
             "Programming Language :: Python :: 3.8",
             "Programming Language :: Python :: 3.9",
             "Topic :: Scientific/Engineering :: Bio-Informatics",


Test patch:
diff --git a/tests/test_plotting.py b/tests/test_plotting.py
index 90d794dd7..99588de05 100644
--- a/tests/test_plotting.py
+++ b/tests/test_plotting.py
@@ -1,5 +1,4 @@
-from typing import Tuple, Union, Callable
-from typing_extensions import Literal
+from typing import Tuple, Union, Literal, Callable
 
 import os
 import pytest