Skip to content
Snippets Groups Projects
typing-ext.patch 8.90 KiB
diff --git a/psycopg/psycopg/_compat.py b/psycopg/psycopg/_compat.py
index 7dbae79..b3f2a1c 100644
--- a/psycopg/psycopg/_compat.py
+++ b/psycopg/psycopg/_compat.py
@@ -11,12 +11,11 @@ from typing import Any, Awaitable, Generator, Optional, Sequence, Union, TypeVar
 # NOTE: TypeAlias cannot be exported by this module, as pyright special-cases it.
 # For this raisin it must be imported directly from typing_extension where used.
 # See https://github.com/microsoft/pyright/issues/4197
-from typing_extensions import TypeAlias
 
 if sys.version_info >= (3, 8):
-    from typing import Protocol
+    from typing import Protocol, TypeAlias
 else:
-    from typing_extensions import Protocol
+    from typing import Protocol
 
 T = TypeVar("T")
 FutureT: TypeAlias = Union["asyncio.Future[T]", Generator[Any, None, T], Awaitable[T]]
@@ -52,12 +51,12 @@ else:
 if sys.version_info >= (3, 10):
     from typing import TypeGuard
 else:
-    from typing_extensions import TypeGuard
+    from typing import TypeGuard
 
 if sys.version_info >= (3, 11):
     from typing import LiteralString
 else:
-    from typing_extensions import LiteralString
+    from typing import LiteralString
 
 __all__ = [
     "Counter",
diff --git a/psycopg/psycopg/_pipeline.py b/psycopg/psycopg/_pipeline.py
index 3c73f7e..49f72ac 100644
--- a/psycopg/psycopg/_pipeline.py
+++ b/psycopg/psycopg/_pipeline.py
@@ -7,7 +7,7 @@ commands pipeline management
 import logging
 from types import TracebackType
 from typing import Any, List, Optional, Union, Tuple, Type, TypeVar, TYPE_CHECKING
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from . import errors as e
diff --git a/psycopg/psycopg/_preparing.py b/psycopg/psycopg/_preparing.py
index 158552b..5fbe7a2 100644
--- a/psycopg/psycopg/_preparing.py
+++ b/psycopg/psycopg/_preparing.py
@@ -7,7 +7,7 @@ Support for prepared statements
 from enum import IntEnum, auto
 from typing import Iterator, Optional, Sequence, Tuple, TYPE_CHECKING
 from collections import OrderedDict
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from ._compat import Deque
diff --git a/psycopg/psycopg/_queries.py b/psycopg/psycopg/_queries.py
index b9b0a58..2506289 100644
--- a/psycopg/psycopg/_queries.py
+++ b/psycopg/psycopg/_queries.py
@@ -8,7 +8,7 @@ import re
 from typing import Any, Callable, Dict, List, Mapping, Match, NamedTuple, Optional
 from typing import Sequence, Tuple, Union, TYPE_CHECKING
 from functools import lru_cache
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from . import errors as e
diff --git a/psycopg/psycopg/_struct.py b/psycopg/psycopg/_struct.py
index 28a6084..a57ddf6 100644
--- a/psycopg/psycopg/_struct.py
+++ b/psycopg/psycopg/_struct.py
@@ -6,7 +6,7 @@ Utility functions to deal with binary structs.
 
 import struct
 from typing import Callable, cast, Optional, Tuple
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from .abc import Buffer
 from . import errors as e
diff --git a/psycopg/psycopg/_transform.py b/psycopg/psycopg/_transform.py
index d5645ec..82121e3 100644
--- a/psycopg/psycopg/_transform.py
+++ b/psycopg/psycopg/_transform.py
@@ -7,7 +7,7 @@ Helper object to transform values between Python and PostgreSQL
 from typing import Any, Dict, List, Optional, Sequence, Tuple
 from typing import DefaultDict, TYPE_CHECKING
 from collections import defaultdict
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from . import postgres
diff --git a/psycopg/psycopg/_typeinfo.py b/psycopg/psycopg/_typeinfo.py
index 08c5e65..8c89065 100644
--- a/psycopg/psycopg/_typeinfo.py
+++ b/psycopg/psycopg/_typeinfo.py
@@ -9,7 +9,7 @@ information to the adapters if needed.
 from enum import Enum
 from typing import Any, Dict, Iterator, Optional, overload
 from typing import Sequence, Tuple, Type, TypeVar, Union, TYPE_CHECKING
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import errors as e
 from .abc import AdaptContext, Query
diff --git a/psycopg/psycopg/abc.py b/psycopg/psycopg/abc.py
index 0cf1a75..868785f 100644
--- a/psycopg/psycopg/abc.py
+++ b/psycopg/psycopg/abc.py
@@ -7,7 +7,7 @@ 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 TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from ._enums import PyFormat as PyFormat
diff --git a/psycopg/psycopg/connection.py b/psycopg/psycopg/connection.py
index ca93053..6ef1ce1 100644
--- a/psycopg/psycopg/connection.py
+++ b/psycopg/psycopg/connection.py
@@ -14,7 +14,7 @@ from weakref import ref, ReferenceType
 from warnings import warn
 from functools import partial
 from contextlib import contextmanager
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from . import errors as e
diff --git a/psycopg/psycopg/errors.py b/psycopg/psycopg/errors.py
index d0a08b7..beebc59 100644
--- a/psycopg/psycopg/errors.py
+++ b/psycopg/psycopg/errors.py
@@ -21,7 +21,7 @@ DBAPI-defined Exceptions are defined in the following hierarchy::
 from dataclasses import dataclass, field, fields
 from typing import Any, Callable, Dict, List, NoReturn, Optional, Sequence, Tuple, Type
 from typing import Union, TYPE_CHECKING
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 from asyncio import CancelledError
 
 from .pq.abc import PGconn, PGresult
diff --git a/psycopg/psycopg/pq/abc.py b/psycopg/psycopg/pq/abc.py
index 971d00e..4f18760 100644
--- a/psycopg/psycopg/pq/abc.py
+++ b/psycopg/psycopg/pq/abc.py
@@ -6,7 +6,7 @@ Protocol objects to represent objects exposed by different pq implementations.
 
 from typing import Any, Callable, List, Optional, Sequence, Tuple
 from typing import Union, TYPE_CHECKING
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from ._enums import Format, Trace
 from .._compat import Protocol
diff --git a/psycopg/psycopg/rows.py b/psycopg/psycopg/rows.py
index 2b240f7..ce50a08 100644
--- a/psycopg/psycopg/rows.py
+++ b/psycopg/psycopg/rows.py
@@ -8,7 +8,7 @@ import functools
 from typing import Any, Callable, Dict, List, Optional, NamedTuple, NoReturn
 from typing import TYPE_CHECKING, Sequence, Tuple, Type, TypeVar
 from collections import namedtuple
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from . import pq
 from . import errors as e
diff --git a/psycopg/psycopg/types/enum.py b/psycopg/psycopg/types/enum.py
index 96a81bf..a037dee 100644
--- a/psycopg/psycopg/types/enum.py
+++ b/psycopg/psycopg/types/enum.py
@@ -4,7 +4,7 @@ Adapters for the enum type.
 from enum import Enum
 from typing import Dict, Generic, Optional, Mapping, Sequence
 from typing import Tuple, Type, TypeVar, Union, cast
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from .. import postgres
 from .. import errors as e
diff --git a/psycopg/psycopg/types/hstore.py b/psycopg/psycopg/types/hstore.py
index e202c27..ffd4310 100644
--- a/psycopg/psycopg/types/hstore.py
+++ b/psycopg/psycopg/types/hstore.py
@@ -6,7 +6,7 @@ Dict to hstore adaptation
 
 import re
 from typing import Dict, List, Optional, Type
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from .. import errors as e
 from .. import postgres
diff --git a/psycopg/psycopg/types/net.py b/psycopg/psycopg/types/net.py
index 36b4053..2c45368 100644
--- a/psycopg/psycopg/types/net.py
+++ b/psycopg/psycopg/types/net.py
@@ -5,7 +5,7 @@ Adapters for network types.
 # Copyright (C) 2020 The Psycopg Team
 
 from typing import Callable, Optional, Type, Union, TYPE_CHECKING
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 from .. import postgres
 from ..pq import Format
diff --git a/psycopg_pool/psycopg_pool/_compat.py b/psycopg_pool/psycopg_pool/_compat.py
index 9fb2b9b..74a0bcc 100644
--- a/psycopg_pool/psycopg_pool/_compat.py
+++ b/psycopg_pool/psycopg_pool/_compat.py
@@ -7,7 +7,7 @@ compatibility functions for different Python versions
 import sys
 import asyncio
 from typing import Any, Awaitable, Generator, Optional, Union, Type, TypeVar
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 import psycopg.errors as e
 
diff --git a/tools/update_oids.py b/tools/update_oids.py
index 9a67abd..47bed7c 100755
--- a/tools/update_oids.py
+++ b/tools/update_oids.py
@@ -19,7 +19,7 @@ import argparse
 import subprocess as sp
 from typing import List
 from pathlib import Path
-from typing_extensions import TypeAlias
+from typing import TypeAlias
 
 import psycopg
 from psycopg.rows import TupleRow
--- a/psycopg/setup.cfg
+++ b/psycopg/setup.cfg
@@ -43,7 +43,6 @@
 zip_safe = False
 install_requires =
     backports.zoneinfo >= 0.2.0; python_version < "3.9"
-    typing-extensions >= 4.1
     tzdata; sys_platform == "win32"
 
 [options.package_data]