This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 89fe37cf20 build(python/adbc_driver_manager): drop runtime dependency 
on typing-extensions (#5026)
89fe37cf20 is described below

commit 89fe37cf2050202685398cb50502e31a4d293306
Author: Edgar Ramírez Mondragón 
<[email protected]>
AuthorDate: Thu Nov 12 20:02:00 2026 -0600

    build(python/adbc_driver_manager): drop runtime dependency on 
typing-extensions (#5026)
    
    It's only needed for type checking, and type checkers ship its stubs.
    Users like me who were getting `typing-extensions` only through
    adbc-driver-manager will no longer get it installed.
    
    `ParamSpec` and `Self` were added to the stdlib in Python 3.10 and 3.11,
    respectively, so it's safe to import them from `typing` unconditionally.
    `types.CapsuleType` was added in Python 3.13, so it's the only import
    that actually requires `typing-extensions`.
    
    Closes #5025
    
    ---------
    
    Signed-off-by: Edgar Ramírez-Mondragón <[email protected]>
---
 ci/scripts/python_wheel_windows_test.ps1            |  2 +-
 dev/release/verify-release-candidate.ps1            |  2 +-
 .../adbc_driver_manager/_dbapi_backend.py           |  7 ++++++-
 .../adbc_driver_manager/_lib.pyi                    | 11 +++++++----
 .../adbc_driver_manager/dbapi.py                    | 21 +++++++++++++++++++--
 python/adbc_driver_manager/pyproject.toml           | 10 ++++++++--
 6 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/ci/scripts/python_wheel_windows_test.ps1 
b/ci/scripts/python_wheel_windows_test.ps1
index 2c1a525be0..401544ce5e 100755
--- a/ci/scripts/python_wheel_windows_test.ps1
+++ b/ci/scripts/python_wheel_windows_test.ps1
@@ -62,7 +62,7 @@ foreach ($Component in $Components) {
     if (-not $?) { throw "Failed to install the $Component wheel" }
 }
 
-python -m pip install pytest typing-extensions
+python -m pip install pytest
 if (-not $?) { throw "Failed to install Python test dependencies" }
 
 foreach ($Component in $Components) {
diff --git a/dev/release/verify-release-candidate.ps1 
b/dev/release/verify-release-candidate.ps1
index 396cdcf7c9..e0ec747307 100755
--- a/dev/release/verify-release-candidate.ps1
+++ b/dev/release/verify-release-candidate.ps1
@@ -169,7 +169,7 @@ function Test-PythonWheels($PythonVersion, $PythonPath) {
         & $PythonPath -m pip install --no-deps --force-reinstall $WheelPaths
         if (-not $?) { throw "Failed to install Python $($PythonVersion) 
wheels" }
 
-        $TestDependencies = @("pytest", "typing-extensions")
+        $TestDependencies = @("pytest")
         if ($IsWindowsPlatform -and -not $IsWindowsArm) {
             $TestDependencies += @("pyarrow", "pandas", "protobuf")
         }
diff --git a/python/adbc_driver_manager/adbc_driver_manager/_dbapi_backend.py 
b/python/adbc_driver_manager/adbc_driver_manager/_dbapi_backend.py
index 36b6691061..b511f47403 100644
--- a/python/adbc_driver_manager/adbc_driver_manager/_dbapi_backend.py
+++ b/python/adbc_driver_manager/adbc_driver_manager/_dbapi_backend.py
@@ -29,7 +29,12 @@ import typing
 from . import _lib
 
 if typing.TYPE_CHECKING:
-    from typing_extensions import CapsuleType
+    import sys
+
+    if sys.version_info >= (3, 13):
+        from types import CapsuleType
+    else:
+        from typing_extensions import CapsuleType
 
 
 class DbapiBackend(abc.ABC):
diff --git a/python/adbc_driver_manager/adbc_driver_manager/_lib.pyi 
b/python/adbc_driver_manager/adbc_driver_manager/_lib.pyi
index 62a3a70c61..ac0e21ccf6 100644
--- a/python/adbc_driver_manager/adbc_driver_manager/_lib.pyi
+++ b/python/adbc_driver_manager/adbc_driver_manager/_lib.pyi
@@ -19,11 +19,14 @@
 
 import enum
 import pathlib
+import sys
 import typing
-from typing import Any, List, Optional, Tuple, Union
+from typing import Any, List, Optional, ParamSpec, Tuple, Union
 
-import typing_extensions
-from typing_extensions import CapsuleType
+if sys.version_info >= (3, 13):
+    from types import CapsuleType
+else:
+    from typing_extensions import CapsuleType
 
 INGEST_OPTION_MODE: str
 INGEST_OPTION_MODE_APPEND: str
@@ -236,7 +239,7 @@ def _test_error(
     sqlstate: Optional[str],
 ) -> Error: ...
 
-_P = typing_extensions.ParamSpec("_P")
+_P = ParamSpec("_P")
 _T = typing.TypeVar("_T")
 
 def _blocking_call(
diff --git a/python/adbc_driver_manager/adbc_driver_manager/dbapi.py 
b/python/adbc_driver_manager/adbc_driver_manager/dbapi.py
index 4af2e3a50f..e7c51c0c7f 100644
--- a/python/adbc_driver_manager/adbc_driver_manager/dbapi.py
+++ b/python/adbc_driver_manager/adbc_driver_manager/dbapi.py
@@ -47,7 +47,18 @@ import time
 import typing
 import warnings
 import weakref
-from typing import Any, Dict, List, Literal, Mapping, NoReturn, Optional, 
Tuple, Union
+from typing import (
+    Any,
+    Dict,
+    List,
+    Literal,
+    Mapping,
+    NoReturn,
+    Optional,
+    Self,
+    Tuple,
+    Union,
+)
 
 try:
     import pyarrow
@@ -64,10 +75,16 @@ from . import _dbapi_backend, _lib
 from ._lib import _blocking_call
 
 if typing.TYPE_CHECKING:
+    import sys
+
     import pandas
     import polars
     import pyarrow
-    from typing_extensions import CapsuleType, Self
+
+    if sys.version_info >= (3, 13):
+        from types import CapsuleType
+    else:
+        from typing_extensions import CapsuleType
 
     from ._reader import AdbcRecordBatchReader
 
diff --git a/python/adbc_driver_manager/pyproject.toml 
b/python/adbc_driver_manager/pyproject.toml
index 59d509cfa9..9e643ecf09 100644
--- a/python/adbc_driver_manager/pyproject.toml
+++ b/python/adbc_driver_manager/pyproject.toml
@@ -24,11 +24,17 @@ license-files = ["LICENSE.txt", "NOTICE.txt"]
 readme = "README.md"
 requires-python = ">=3.11"
 dynamic = ["version"]
-dependencies = ["typing-extensions"]
 
 [project.optional-dependencies]
 dbapi = ["pandas", "pyarrow>=14.0.1"]
-test = ["duckdb", "pandas", "polars", "pyarrow>=14.0.1", "pytest>=9"]
+test = [
+    "duckdb",
+    "pandas",
+    "polars",
+    "pyarrow>=14.0.1",
+    "pytest>=9",
+    "typing-extensions>=4.12 ; python_version<'3.13'",
+]
 
 [project.urls]
 homepage = "https://arrow.apache.org/adbc/";

Reply via email to