From 83aa04ac10566d9a2f3247564d14a76dcd2c0984 Mon Sep 17 00:00:00 2001 From: Evert Lammerts Date: Fri, 31 Oct 2025 14:59:49 +0100 Subject: [PATCH] Enable pyarrow with python 3.14 --- pyproject.toml | 8 ++++---- tests/conftest.py | 42 ------------------------------------------ 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7df13b61..f5983840 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ all = [ # users can install duckdb with 'duckdb[all]', which will install this l "fsspec", # used in duckdb.filesystem "numpy", # used in duckdb.experimental.spark and in duckdb.fetchnumpy() "pandas", # used for pandas dataframes all over the place - "pyarrow; python_version < '3.14'", # used for pyarrow support + "pyarrow", # used for pyarrow support "adbc-driver-manager", # for the adbc driver ] @@ -226,7 +226,7 @@ stubdeps = [ # dependencies used for typehints in the stubs "fsspec", "pandas", "polars", - "pyarrow; python_version < '3.14'", + "pyarrow", ] test = [ # dependencies used for running tests "adbc-driver-manager", @@ -248,7 +248,7 @@ test = [ # dependencies used for running tests "urllib3", "fsspec>=2022.11.0", "pandas>=2.0.0", - "pyarrow>=18.0.0; python_version < '3.14'", + "pyarrow>=18.0.0", "torch>=2.2.2; python_version < '3.14' and ( sys_platform != 'darwin' or platform_machine != 'x86_64' or python_version < '3.13' )", "tensorflow==2.14.0; sys_platform == 'darwin' and python_version < '3.12'", "tensorflow-cpu>=2.14.0; sys_platform == 'linux' and platform_machine != 'aarch64' and python_version < '3.12'", @@ -265,7 +265,7 @@ scripts = [ # dependencies used for running scripts "pandas", "pcpp", "polars", - "pyarrow; python_version < '3.14'", + "pyarrow", "pytz" ] pypi = [ # dependencies used by the pypi cleanup script diff --git a/tests/conftest.py b/tests/conftest.py index f2ad7cec..bfb458a5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,4 @@ import os -import sys import warnings from importlib import import_module from pathlib import Path @@ -36,47 +35,6 @@ def import_pandas(): pytest.skip("Couldn't import pandas") -@pytest.hookimpl(hookwrapper=True) -def pytest_runtest_call(item): - """Convert missing pyarrow imports to skips. - - TODO(evertlammerts): Remove skip when pyarrow releases for 3.14. - https://github.com/duckdblabs/duckdb-internal/issues/6182 - """ - outcome = yield - if sys.version_info[:2] == (3, 14): - try: - outcome.get_result() - except ImportError as e: - if e.name == "pyarrow": - pytest.skip(f"pyarrow not available - {item.name} requires pyarrow") - else: - raise - - -@pytest.hookimpl(hookwrapper=True) -def pytest_make_collect_report(collector): - """Wrap module collection to catch pyarrow import errors on Python 3.14. - - If we're on Python 3.14 and a test module raises ModuleNotFoundError - for 'pyarrow', mark the entire module as xfailed rather than failing collection. - - TODO(evertlammerts): Remove skip when pyarrow releases for 3.14. - https://github.com/duckdblabs/duckdb-internal/issues/6182 - """ - outcome = yield - report: pytest.CollectReport = outcome.get_result() - - if sys.version_info[:2] == (3, 14): - # Only handle failures from module collectors - if report.failed and collector.__class__.__name__ == "Module": - longreprtext = report.longreprtext - if "ModuleNotFoundError: No module named 'pyarrow'" in longreprtext: - report.outcome = "skipped" - reason = f"XFAIL: [pyarrow not available] {longreprtext}" - report.longrepr = (report.fspath, None, reason) - - # https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option # https://stackoverflow.com/a/47700320 def pytest_addoption(parser):