Skip to content

Conversation

paultiq
Copy link
Contributor

@paultiq paultiq commented Sep 15, 2025

Per Discussion: Python 3.14 Free-Threading Support, this is the first step / pre-requisite for free-threading work.

This PR adds Python 3.14 & 3.14t (rc2) builds, with a test change to handle not-yet-available dependencies.

Free Threading is not enabled by this

Free threading is not implemented here. If DuckDB is imported in 3.14t, the GIL is enabled with the following warning:

<frozen importlib._bootstrap>:491: RuntimeWarning: The global interpreter lock (GIL) has been enabled to load module '_duckdb', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.

Timeline

Changes

  • Update uv to 0.8.16 and cibuilwheel to 3.1.x: needed for the latest Python builds
  • Added Windows specific build flags for 3.14t
  • Add markers to disable dependencies that don't yet support 3.14

Notes:


edit: strikethrough reverted changes

- { minimal: true, python: cp311 }
- { minimal: true, python: cp312 }
- { minimal: true, platform: { arch: universal2 } }
- { python: cp314t, platform: { os: windows-2025 } }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a comment (and a todo?) for why this combination is excluded

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment and TODO

CIBW_ARCHS: ${{ matrix.platform.arch == 'amd64' && 'AMD64' || matrix.platform.arch }}
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}

CIBW_ENVIRONMENT: PYTHON_GIL=1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this enables the GIL on free-threaded python? Maybe add a comment here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment and TODO

Comment on lines 56 to 63
def pytest_runtest_call(item):
"""Convert pandas requirement exceptions to skips"""
outcome = yield
try:
outcome.get_result()
except Exception as e:
if "'pandas' is required for this operation but it was not installed" in str(e):
pytest.skip("pandas not available - test requires pandas functionality")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a catchall for Python 3.14 isn't it? Maybe we can add a check for the version (e.g. check sys.version_info) and as well, and reraise if the version < 3.14? I've forgotten to install test dependencies too often to allow myself to skip tests.

Also, this probably deserves another TODO. Hopefully that nudges us to remove this once pandas does support >= 3.14.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My immediate idea was that this is useful for any pre-release version of Python.

Perhaps add the check + a TODO to bump it to 3.15 once Pandas ships for 3.14?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed the version check and TODO.

if sys.version_info[:2] == (3, 14):
try:
outcome.get_result()
except Exception as e:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: duckdb is already imported - may as well catch duckdb.InvalidInputException. Also - I don't know hookwrappers well enough, but aren't you supposed to return the outcome?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, narrowed to duckdb.InvalidInputException.

Regarding pytest_runtest_call : src, this is correct - it returns None. These are specific hooks, rather than a general hookwrapper.

evertlammerts
evertlammerts previously approved these changes Sep 15, 2025
Copy link
Collaborator

@evertlammerts evertlammerts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks for this!

evertlammerts
evertlammerts previously approved these changes Sep 16, 2025
@evertlammerts
Copy link
Collaborator

Cancelled the checks to make space on CI for the release build

@paultiq
Copy link
Contributor Author

paultiq commented Sep 16, 2025

I've run it on my fork, fyi.

@paultiq
Copy link
Contributor Author

paultiq commented Sep 16, 2025

Now that #48 is merged, I'll retest and remove the xfail for the case

Copy link
Collaborator

@evertlammerts evertlammerts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@evertlammerts evertlammerts added this pull request to the merge queue Sep 17, 2025
Merged via the queue into duckdb:main with commit 83d839c Sep 17, 2025
44 checks passed
@paultiq paultiq deleted the ci314t branch October 8, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants