Skip to content

Commit

Permalink
✨ Python 3.13 Support (#498)
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.

Signed-off-by: burgholzer <[email protected]>
  • Loading branch information
burgholzer authored Aug 8, 2024
1 parent 8a844b2 commit e3aee21
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 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
with:
setup-z3: true
z3-version: 4.12.6 # 4.13.0 has incorrectly tagged manylinux wheels
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,38 @@ 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:
setup-z3: true

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:
setup-z3: true

python-tests:
name: 🐍 Test
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-python-tests)
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-ci.yml@v1.1.5
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-ci.yml@v1.2.1
with:
skip-testing-latest-python: true
setup-z3: 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
with:
setup-z3: true

Expand Down
2 changes: 1 addition & 1 deletion cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if(BUILD_MQT_QMAP_BINDINGS)
endif()

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

# cmake-format: off
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
8 changes: 5 additions & 3 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 @@ -31,6 +31,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Development Status :: 5 - Production/Stable",
"Typing :: Typed",
]
Expand Down Expand Up @@ -264,8 +265,9 @@ build = "cp3*"
skip = "*-musllinux*"
archs = "auto64"
test-command = "python -c \"from mqt import qmap\""
test-skip = "cp38-macosx_arm64"
test-skip = ["cp38-macosx_arm64", "cp313*"] # skip testing on Python 3.13 until our dependencies are ready
build-frontend = "build[uv]"
free-threaded-support = true

[tool.cibuildwheel.linux]
environment = { Z3_ROOT="/opt/python/cp311-cp311/lib/python3.11/site-packages/z3", DEPLOY="ON" }
Expand All @@ -279,6 +281,6 @@ repair-wheel-command = [
environment = { MACOSX_DEPLOYMENT_TARGET = "11.0" }

[tool.cibuildwheel.windows]
before-build = "pip install delvewheel>=1.4.0"
before-build = "pip install delvewheel>=1.7.3"
repair-wheel-command = "delvewheel repair -v -w {dest_dir} {wheel} --namespace-pkg mqt"
environment = { CMAKE_GENERATOR = "Ninja" }
2 changes: 1 addition & 1 deletion src/python/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ MappingResults map(const py::object& circ, Architecture& arch,
return results;
}

PYBIND11_MODULE(pyqmap, m) {
PYBIND11_MODULE(pyqmap, m, py::mod_gil_not_used()) {
m.doc() = "pybind11 for the MQT QMAP quantum circuit mapping tool";

// Pre-defined architecture available within QMAP
Expand Down

0 comments on commit e3aee21

Please sign in to comment.