]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Make the dependency on typing_extension optional
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 14 May 2021 14:51:17 +0000 (16:51 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 14 May 2021 14:51:17 +0000 (16:51 +0200)
psycopg3/psycopg3/pq/proto.py
psycopg3/psycopg3/proto.py
psycopg3/psycopg3/rows.py
psycopg3/psycopg3/utils/compat.py
psycopg3/setup.cfg

index 53c85c2ae1588455a63965facac6d565b1cf6a71..e8adca98fbf9867c9a5db675730c7233d6ff06a7 100644 (file)
@@ -6,9 +6,9 @@ Protocol objects to represent objects exposed by different pq implementations.
 
 from typing import Any, Callable, List, Optional, Sequence, Tuple, Union
 from typing import TYPE_CHECKING
-from typing_extensions import Protocol
 
 from ._enums import Format
+from ..utils.compat import Protocol
 
 if TYPE_CHECKING:
     from .misc import PGnotify, ConninfoOption, PGresAttDesc
index 4bf1e7633e0476ce6165d11987f106e88a8bdb8b..f6643e54d1e50c8851b38f09c0987f454656d352 100644 (file)
@@ -7,10 +7,10 @@ Protocol objects representing different implementations of the same classes.
 from typing import Any, Callable, Generator, Mapping
 from typing import List, Optional, Sequence, Tuple, TypeVar, Union
 from typing import TYPE_CHECKING
-from typing_extensions import Protocol
 
 from . import pq
 from ._enums import Format
+from .utils.compat import Protocol
 
 if TYPE_CHECKING:
     from .sql import Composable
index 4aafe3500df646a32dbfdda08a3ef3c746aeaff8..4fdab440ca5e02118f0fdca8b7175c9380ccb5e7 100644 (file)
@@ -9,9 +9,9 @@ import re
 from collections import namedtuple
 from typing import Any, Callable, Dict, NamedTuple, Sequence, Tuple, Type
 from typing import TypeVar, TYPE_CHECKING
-from typing_extensions import Protocol
 
 from . import errors as e
+from .utils.compat import Protocol
 
 if TYPE_CHECKING:
     from .cursor import AnyCursor
index 0bbe62e32fcd9f2278ed5740e5cd8342aa094206..7f97bc05a451899fae7976e9f94611c2eac503ab 100644 (file)
@@ -8,6 +8,11 @@ import sys
 import asyncio
 from typing import Any, Awaitable, Generator, Optional, Union, TypeVar
 
+if sys.version_info >= (3, 8):
+    from typing import Protocol
+else:
+    from typing_extensions import Protocol
+
 T = TypeVar("T")
 FutureT = Union["asyncio.Future[T]", Generator[Any, None, T], Awaitable[T]]
 
@@ -44,4 +49,10 @@ else:
 
     Task = asyncio.Future
 
-__all__ = ["asynccontextmanager", "get_running_loop", "create_task"]
+
+__all__ = [
+    "Protocol",
+    "asynccontextmanager",
+    "create_task",
+    "get_running_loop",
+]
index b3d9de0303cbebd9a84fdb5cb9b7cfb262a81efe..85164391f9361b1ee8a478946d1aae878017c46a 100644 (file)
@@ -30,8 +30,7 @@ python_requires = >= 3.6
 packages = find:
 zip_safe = False
 install_requires =
-    typing_extensions
-
+    typing_extensions; python_version < "3.8"
 
 [options.package_data]
 psycopg3_c = py.typed