Repository navigation
Declare free-threading support, and test on Python 3.14t - #14
Merged
Merged
Conversation
Triangulation already releases the GIL and guards each instance with its own mutex, so the module is safe without the GIL. Without the declaration, importing PythonCDT on a free-threaded Python turns the GIL back on for the whole process.
Owner
|
Thank you, Aidan! Looks good to me. |
Contributor
Author
|
Thanks Artem! |
artem-ogre
added a commit
that referenced
this pull request
Oct 6, 2026
* Package for PyPI with scikit-build-core Replace setup.py with scikit-build-core and move the metadata into pyproject.toml. The setuptools sdist contained no sources; the new one includes the CDT submodule and builds on its own. pybind11 now comes from the build requirements instead of a submodule, numpy is declared as a dependency, and Python 3.10 or newer is required. Rename the package to pythoncdt and make it a package with the compiled module as pythoncdt._core, so that it can ship type stubs (_core.pyi and py.typed). CI checks the stubs against the module with mypy.stubtest. Build wheels with cibuildwheel for Linux, macOS and Windows, and publish them to PyPI with trusted publishing when a GitHub release is published. Run the tests on several threads at once on free-threaded Python. Declare the package and its free-threading support stable. * Take the version from git tags, and draft releases with Release Drafter The version is no longer set in pyproject.toml: setuptools-scm takes it from the git tag, so publishing a GitHub release tagged 2.1.0 publishes version 2.1.0 to PyPI. Builds between releases get dev versions. Release Drafter keeps a draft of the next release, listing the merged pull requests and choosing the version from their labels: major, minor, or patch when unlabeled. Publishing the draft releases it. * Lint and format with ruff, enforced by pre-commit Add pre-commit hooks running ruff's linter and formatter, and a CI job running the same hooks so that unformatted or failing code can't be merged. Fix what the linter found and reformat the tests. * Simplify the version define and the test checksums CMake passes the version as a string literal, so the stringify macros and the "dev" fallback are gone. The tests hash the OFF text in memory instead of writing it to a temporary file. * Update CDT to 2.0.1 The update only bumps CDT's version and its docs, so the bindings need no changes. * Fix the V2d and Edge buffers, and the version in CI The V2d and Edge buffers had twice the item size as stride, so the second item was read past the end of the object, and Edge reported its items as doubles. Their constructors read past short buffers and ignored strides. They now reuse the checks of the insert overloads, and the Edge buffer is read-only so that it can't break the v1 < v2 order. The stubs declare __buffer__ for both classes, so type checkers accept them as buffers. CI fetches the full history, so the test builds get the version from the git tags. * Credit the packaging contributors Their pull requests (#8, #14 and #15) shaped how PythonCDT is packaged and published to PyPI. Co-authored-by: Mauricio Souza de Alencar <856825+mdealencar@users.noreply.github.com> Co-authored-by: Aidan Newsome <32934243+aidannewsome@users.noreply.github.com> * Publish to PyPI only from artem-ogre/PythonCDT, so a fork's release builds the wheels without a failed publish --------- Co-authored-by: Mauricio Souza de Alencar <856825+mdealencar@users.noreply.github.com> Co-authored-by: Aidan Newsome <32934243+aidannewsome@users.noreply.github.com> Co-authored-by: aidannewsome <aidan.newsome@me.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Triangulationalready releases the GIL and guards each instance with its own mutex, so the module is safe to use without the GIL. It just doesn't declare that, so importing PythonCDT on a free-threaded Python turns the GIL back on for the whole process.PYBIND11_MODULE(PythonCDT, m, py::mod_gil_not_used()).On Python 3.14t the GIL stays off after import, all 27 tests pass, and
benchmark_gil_release.pygives a 5.5x speedup on 8 threads.CI passes on my fork: https://github.com/aidannewsome/PythonCDT/actions/runs/37171486611