Skip to content

Commit

Permalink
✨ Python 3.13 Support (#656)
Browse files Browse the repository at this point in the history
## Description

The (ABI-stable) release candidate for Python 3.13 just released and the
newest MQT Workflows include an updated version of cibuildwheel that
supports building wheels for it.

This PR enables regular Python 3.13 builds and also enables builds for
the new free-threaded variant.

## Checklist:

<!---
This checklist serves as a reminder of a couple of things that ensure
your pull request will be merged swiftly.
-->

- [x] The pull request only contains commits that are related to it.
- [x] I have added appropriate tests and documentation.
- [x] I have made sure that all CI jobs on GitHub pass.
- [x] The pull request introduces no new warnings and follows the
project's style guidelines.
  • Loading branch information
burgholzer authored Aug 7, 2024
2 parents 768154b + f86089f commit 2a7a929
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
python-packaging:
name: 🐍 Packaging
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.1.5
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.2.1

deploy:
if: github.event_name == 'release' && github.event.action == 'published'
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,37 @@ concurrency:
jobs:
change-detection:
name: 🔍 Change
uses: cda-tum/mqt-workflows/.github/workflows/reusable-change-detection.yml@v1.1.5
uses: cda-tum/mqt-workflows/.github/workflows/reusable-change-detection.yml@v1.2.1

cpp-tests:
name: 🇨‌ Test
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-tests)
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-ci.yml@v1.1.5
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-ci.yml@v1.2.1
with:
cmake-args-macos: -DMQT_CORE_WITH_GMP=ON

cpp-linter:
name: 🇨‌ Lint
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-linter)
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-linter.yml@v1.1.5
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-linter.yml@v1.2.1
with:
cmake-args: -DBUILD_MQT_CORE_BENCHMARKS=ON

python-tests:
name: 🐍 Test
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-python-tests)
uses: cda-tum/mqt-workflows/.github/workflows/[email protected]
uses: cda-tum/mqt-workflows/.github/workflows/[email protected]
with:
skip-testing-latest-python: true

code-ql:
name: 📝 CodeQL
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-code-ql)
uses: cda-tum/mqt-workflows/.github/workflows/reusable-code-ql.yml@v1.1.5
uses: cda-tum/mqt-workflows/.github/workflows/reusable-code-ql.yml@v1.2.1

required-checks-pass: # This job does nothing and is only used for branch protection
name: 🚦 Check
Expand Down
2 changes: 1 addition & 1 deletion cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(BUILD_MQT_CORE_BINDINGS)
message(STATUS "Python executable: ${Python_EXECUTABLE}")

# add pybind11 library
find_package(pybind11 CONFIG REQUIRED)
find_package(pybind11 2.13 CONFIG REQUIRED)
endif()

set(JSON_VERSION
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

nox.options.sessions = ["lint", "tests"]

PYTHON_ALL_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
PYTHON_ALL_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

# The following lists all the build requirements for building the package.
# Note that this includes transitive build dependencies of package dependencies,
Expand All @@ -28,7 +28,7 @@
BUILD_REQUIREMENTS = [
"scikit-build-core[pyproject]>=0.8.1",
"setuptools_scm>=7",
"pybind11>=2.12",
"pybind11>=2.13",
"wheel>=0.40", # transitive dependency of pytest on Windows
]

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["scikit-build-core>=0.8.1", "setuptools-scm>=7", "pybind11>=2.12"]
requires = ["scikit-build-core>=0.8.1", "setuptools-scm>=7", "pybind11>=2.13"]
build-backend = "scikit_build_core.build"

[project]
Expand Down Expand Up @@ -28,6 +28,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
"Typing :: Typed",
]
Expand Down Expand Up @@ -278,6 +279,7 @@ archs = "auto64"
test-command = "python -c \"from mqt import core\""
test-skip = "cp38-macosx_arm64"
build-frontend = "build[uv]"
free-threaded-support = true

[tool.cibuildwheel.linux]
environment = { DEPLOY = "ON" }
Expand All @@ -286,6 +288,6 @@ environment = { DEPLOY = "ON" }
environment = { MACOSX_DEPLOYMENT_TARGET = "10.15" }

[tool.cibuildwheel.windows]
before-build = "uv pip install delvewheel>=1.4.0"
before-build = "uv pip install delvewheel>=1.7.3"
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel} --namespace-pkg mqt"
environment = { CMAKE_GENERATOR = "Ninja" }
2 changes: 1 addition & 1 deletion src/python/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void registerOperations(py::module& m);
void registerSymbolic(py::module& m);
void registerQuantumComputation(py::module& m);

PYBIND11_MODULE(_core, m) {
PYBIND11_MODULE(_core, m, py::mod_gil_not_used()) {
registerPermutation(m);

py::module symbolic = m.def_submodule("symbolic");
Expand Down

0 comments on commit 2a7a929

Please sign in to comment.