Skip to content

Commit 185c964

Browse files
authored
✨ switch to mqt-core Python package (#336)
## Description This PR switches the project to use the newly developed `mqt-core` Python package. Any Python package build will only require the `mqt-core` package as a build and runtime dependency and won't have to rely on fetched version of mqt-core any more. Any regular C++ build will still use the `FetchContent` CMake module. The change brings a range of advantages: - Uses the new `load` function of `mqt-core` that allows to load any supported circuit format as input and has better handling for Qiskit `QuantumCircuit` objects. - Simplifies the interfaces of the DDSIM Python bindings - Allows OpenQASM3 as an input format. In addition, this PR updates mqt-ddsim to most of the current best practices within the MQT. ## 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.
2 parents babc960 + fd95157 commit 185c964

57 files changed

Lines changed: 1100 additions & 1771 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FormatStyle: file
22

33
Checks: |
4-
boost-*,
54
bugprone-*,
65
-bugprone-easily-swappable-parameters,
76
-bugprone-unchecked-optional-access,
@@ -13,6 +12,8 @@ Checks: |
1312
-cppcoreguidelines-special-member-functions,
1413
-cppcoreguidelines-avoid-magic-numbers,
1514
-cppcoreguidelines-macro-usage,
15+
-cppcoreguidelines-pro-type-reinterpret-cast,
16+
-cppcoreguidelines-pro-bounds-constant-array-index,
1617
-cppcoreguidelines-avoid-do-while,
1718
google-*,
1819
-google-readability-todo,
@@ -23,6 +24,7 @@ Checks: |
2324
modernize-*,
2425
-modernize-use-trailing-return-type,
2526
performance-*,
27+
-performance-no-int-to-ptr,
2628
portability-*,
2729
readability-*,
2830
-readability-identifier-length,
@@ -72,3 +74,5 @@ CheckOptions:
7274
value: CamelCase
7375
- key: readability-identifier-naming.VariableCase
7476
value: camelBack
77+
- key: misc-include-cleaner.IgnoreHeaders
78+
value: pybind11/detail/.*

.github/renovate.json5

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
lockFileMaintenance: {
1010
"enabled": true,
11-
// "automerge": true, disabled due to endless update loops caused by setuptools_scm
11+
"automerge": true,
1212
},
1313
configMigration: true,
1414
labels: ["dependencies"],
@@ -30,9 +30,16 @@
3030
commitMessagePrefix: "⬆\uFE0F\uD83E\uDE9D",
3131
},
3232
{
33-
"description": "Automerge patch updates",
34-
"matchUpdateTypes": ["patch"],
35-
"automerge": true
33+
description: "Automerge patch updates",
34+
matchUpdateTypes: ["patch"],
35+
automerge: true
36+
},
37+
{
38+
description: "Automerge minor updates for stable dependencies",
39+
matchManagers: ["pep621", "pre-commit"],
40+
matchUpdateTypes: ["minor", "patch"],
41+
matchCurrentVersion: "!/^0/",
42+
automerge: true
3643
}
3744
]
3845
}

.github/workflows/cd.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
name: CD
1+
name: CD 🚀
22
on:
3-
push:
4-
branches: [main]
53
release:
64
types: [published]
75
workflow_dispatch:
@@ -13,36 +11,11 @@ permissions:
1311

1412
jobs:
1513
# Builds the sdist and wheels on all supported platforms and uploads the resulting
16-
# wheels as GitHub artifacts `dev-cibw-*`, `test-cibw-*`, or `cibw-*`, depending on
17-
# whether the workflow is triggered from a PR, a push to main, or a release, respectively.
14+
# wheels as GitHub artifacts `dev-cibw-*` or `cibw-*`, depending on whether the
15+
# workflow is triggered from a PR or a release, respectively.
1816
python-packaging:
1917
name: 🐍 Packaging
20-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.5
21-
with:
22-
# Do not include local version information on pushes to main to facilitate TestPyPI uploads.
23-
no-local-version: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
24-
# Do not build emulated wheels on pushes to main to reduce runner load for CD.
25-
build-emulated-wheels: ${{ github.ref != 'refs/heads/main' || github.event_name != 'push' }}
26-
27-
# Downloads the previously generated artifacts and deploys to TestPyPI on pushes to main
28-
deploy-test-pypi:
29-
name: 🚀 Deploy to Test PyPI
30-
runs-on: ubuntu-latest
31-
environment:
32-
name: test-pypi
33-
url: https://test.pypi.org/p/mqt.ddsim
34-
needs: [python-packaging]
35-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
36-
steps:
37-
- uses: actions/download-artifact@v4
38-
with:
39-
pattern: test-cibw-*
40-
path: dist
41-
merge-multiple: true
42-
- uses: pypa/gh-action-pypi-publish@release/v1
43-
with:
44-
repository-url: https://test.pypi.org/legacy/
45-
attestations: true
18+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.7
4619

4720
# Downloads the previously generated artifacts and deploys to PyPI on published releases.
4821
deploy:
@@ -64,5 +37,3 @@ jobs:
6437
with:
6538
subject-path: "dist/*"
6639
- uses: pypa/gh-action-pypi-publish@release/v1
67-
with:
68-
attestations: true

.github/workflows/ci.yml

Lines changed: 158 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,59 +14,190 @@ concurrency:
1414
jobs:
1515
change-detection:
1616
name: 🔍 Change
17-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-change-detection.yml@v1.5
17+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-change-detection.yml@v1.7
1818

1919
cpp-tests:
2020
name: 🇨‌ Test
2121
needs: change-detection
2222
if: fromJSON(needs.change-detection.outputs.run-cpp-tests)
23-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-ci.yml@v1.5
23+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-ci.yml@v1.7
24+
with:
25+
# Runs to enable
26+
enable-ubuntu2404-gcc-release: true
27+
enable-ubuntu2404-arm-gcc-release: true
28+
enable-macos13-clang-release: true
29+
enable-macos14-clang-release: true
30+
enable-windows2022-msvc-release: true
31+
# Runs to disable
32+
enable-ubuntu2404-gcc-debug: false
33+
enable-ubuntu2404-clang-release: false
34+
enable-ubuntu2404-clang-debug: false
35+
enable-ubuntu2204-gcc-release: false
36+
enable-ubuntu2204-gcc-debug: false
37+
enable-ubuntu2204-clang-release: false
38+
enable-ubuntu2204-clang-debug: false
39+
enable-ubuntu2404-arm-gcc-debug: false
40+
enable-ubuntu2404-arm-clang-release: false
41+
enable-ubuntu2404-arm-clang-debug: false
42+
enable-ubuntu2204-arm-gcc-release: false
43+
enable-ubuntu2204-arm-gcc-debug: false
44+
enable-ubuntu2204-arm-clang-release: false
45+
enable-ubuntu2204-arm-clang-debug: false
46+
enable-macos13-clang-debug: false
47+
enable-macos13-gcc-release: false
48+
enable-macos13-gcc-debug: false
49+
enable-macos14-clang-debug: false
50+
enable-macos14-gcc-release: false
51+
enable-macos14-gcc-debug: false
52+
enable-macos15-clang-release: false
53+
enable-macos15-clang-debug: false
54+
enable-macos15-gcc-release: false
55+
enable-macos15-gcc-debug: false
56+
enable-windows2022-msvc-debug: false
57+
enable-windows2022-clang-release: false
58+
enable-windows2022-clang-debug: false
59+
enable-windows2025-msvc-release: false
60+
enable-windows2025-msvc-debug: false
61+
enable-windows2025-clang-release: false
62+
enable-windows2025-clang-debug: false
63+
64+
# run extensive C++ tests whenever this is on a PR and the PR has the `extensive-cpp-ci` label
65+
cpp-tests-extensive:
66+
name: 🇨‌ Test (Extensive)
67+
needs: change-detection
68+
if: fromJSON(needs.change-detection.outputs.run-cpp-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci')
69+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-ci.yml@v1.7
70+
with:
71+
# Runs to enable
72+
enable-ubuntu2404-gcc-debug: true
73+
enable-ubuntu2404-clang-release: true
74+
enable-ubuntu2404-clang-debug: true
75+
enable-ubuntu2204-gcc-release: true
76+
enable-ubuntu2204-gcc-debug: true
77+
enable-ubuntu2204-clang-release: true
78+
enable-ubuntu2204-clang-debug: true
79+
enable-ubuntu2404-arm-gcc-debug: true
80+
enable-ubuntu2404-arm-clang-release: true
81+
enable-ubuntu2404-arm-clang-debug: true
82+
enable-ubuntu2204-arm-gcc-release: true
83+
enable-ubuntu2204-arm-gcc-debug: true
84+
enable-ubuntu2204-arm-clang-release: true
85+
enable-ubuntu2204-arm-clang-debug: true
86+
enable-macos13-clang-debug: true
87+
enable-macos13-gcc-release: true
88+
enable-macos13-gcc-debug: true
89+
enable-macos14-clang-debug: true
90+
enable-macos14-gcc-release: true
91+
enable-macos14-gcc-debug: true
92+
enable-macos15-clang-release: true
93+
enable-macos15-clang-debug: true
94+
enable-macos15-gcc-release: true
95+
enable-macos15-gcc-debug: true
96+
enable-windows2022-msvc-debug: true
97+
enable-windows2022-clang-release: true
98+
enable-windows2022-clang-debug: true
99+
enable-windows2025-msvc-release: true
100+
enable-windows2025-msvc-debug: true
101+
enable-windows2025-clang-release: true
102+
enable-windows2025-clang-debug: true
103+
# Runs to disable (these are already enabled in the non-extensive run)
104+
enable-ubuntu2404-gcc-release: false
105+
enable-ubuntu2404-arm-gcc-release: false
106+
enable-macos13-clang-release: false
107+
enable-macos14-clang-release: false
108+
enable-windows2022-msvc-release: false
109+
110+
cpp-coverage:
111+
name: 🇨‌ Coverage
112+
needs: change-detection
113+
if: fromJSON(needs.change-detection.outputs.run-cpp-tests)
114+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-coverage.yml@v1.7
24115
# Explicitly set permissions so that the workflows also work from forks.
25116
permissions:
26117
contents: read # Required for the `actions/checkout` action
27118
id-token: write # Required for the `codecov/codecov-action` action
28-
with:
29-
cmake-args: ""
30-
cmake-args-ubuntu: -G Ninja
31-
cmake-args-macos: -G Ninja
32-
cmake-args-windows: -T ClangCL
33119

34120
cpp-linter:
35121
name: 🇨‌ Lint
36122
needs: change-detection
37123
if: fromJSON(needs.change-detection.outputs.run-cpp-linter)
38-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-linter.yml@v1.5
124+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-cpp-linter.yml@v1.7
39125

126+
# run extensive Python tests whenever this is on a PR and the PR has the `extensive-python-ci` label
40127
python-tests:
41128
name: 🐍 Test
42129
needs: change-detection
43130
if: fromJSON(needs.change-detection.outputs.run-python-tests)
44-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-ci.yml@v1.5
131+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-ci.yml@v1.7
45132
# Explicitly set permissions so that the workflows also work from forks.
46133
permissions:
47134
contents: read # Required for the `actions/checkout` action
48135
id-token: write # Required for the `codecov/codecov-action` action
136+
with:
137+
# Runs to enable
138+
enable-ubuntu2404: true
139+
enable-ubuntu2404-arm: true
140+
enable-macos13: true
141+
enable-macos14: true
142+
enable-windows2022: true
143+
# Runs to disable
144+
enable-ubuntu2204: false
145+
enable-ubuntu2204-arm: false
146+
enable-macos15: false
147+
enable-windows2025: false
148+
149+
python-tests-extensive:
150+
name: 🐍 Test (Extensive)
151+
needs: change-detection
152+
if: fromJSON(needs.change-detection.outputs.run-python-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-python-ci')
153+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-ci.yml@v1.7
154+
# Explicitly set permissions so that the workflows also work from forks.
155+
permissions:
156+
contents: read # Required for the `actions/checkout` action
157+
id-token: write # Required for the `codecov/codecov-action` action
158+
with:
159+
# Runs to enable
160+
enable-ubuntu2204: true
161+
enable-ubuntu2204-arm: true
162+
enable-macos15: true
163+
enable-windows2025: true
164+
# Runs to disable (these are already enabled in the non-extensive run)
165+
enable-ubuntu2404: false
166+
enable-ubuntu2404-arm: false
167+
enable-macos13: false
168+
enable-macos14: false
169+
enable-windows2022: false
170+
171+
python-linter:
172+
name: 🐍 Lint
173+
needs: change-detection
174+
if: fromJSON(needs.change-detection.outputs.run-python-tests)
175+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-linter.yml@v1.7
49176

50177
code-ql:
51178
name: 📝 CodeQL
52179
needs: change-detection
53180
if: fromJSON(needs.change-detection.outputs.run-code-ql)
54-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-code-ql.yml@v1.5
181+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-code-ql.yml@v1.7
55182

56183
cd:
57184
name: 🚀 CD
58185
needs: change-detection
59186
if: fromJSON(needs.change-detection.outputs.run-cd)
60-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.5
187+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-python-packaging.yml@v1.7
61188

62189
required-checks-pass: # This job does nothing and is only used for branch protection
63190
name: 🚦 Check
64191
if: always()
65192
needs:
66193
- change-detection
67194
- cpp-tests
195+
- cpp-tests-extensive
196+
- cpp-coverage
68197
- cpp-linter
69198
- python-tests
199+
- python-tests-extensive
200+
- python-linter
70201
- code-ql
71202
- cd
72203
runs-on: ubuntu-latest
@@ -79,6 +210,14 @@ jobs:
79210
fromJSON(needs.change-detection.outputs.run-cpp-tests)
80211
&& '' || 'cpp-tests,'
81212
}}
213+
${{
214+
fromJSON(needs.change-detection.outputs.run-cpp-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-cpp-ci')
215+
&& '' || 'cpp-tests-extensive,'
216+
}}
217+
${{
218+
fromJSON(needs.change-detection.outputs.run-cpp-tests)
219+
&& '' || 'cpp-coverage,'
220+
}}
82221
${{
83222
fromJSON(needs.change-detection.outputs.run-cpp-linter)
84223
&& '' || 'cpp-linter,'
@@ -87,6 +226,14 @@ jobs:
87226
fromJSON(needs.change-detection.outputs.run-python-tests)
88227
&& '' || 'python-tests,'
89228
}}
229+
${{
230+
fromJSON(needs.change-detection.outputs.run-python-tests) && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'extensive-python-ci')
231+
&& '' || 'python-tests-extensive,'
232+
}}
233+
${{
234+
fromJSON(needs.change-detection.outputs.run-python-tests)
235+
&& '' || 'python-linter,'
236+
}}
90237
${{
91238
fromJSON(needs.change-detection.outputs.run-code-ql)
92239
&& '' || 'code-ql,'

.github/workflows/update-mqt-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ concurrency:
2121
jobs:
2222
update-mqt-core:
2323
name: ⬆️ Update MQT Core
24-
uses: cda-tum/mqt-workflows/.github/workflows/reusable-mqt-core-update.yml@v1.5
24+
uses: cda-tum/mqt-workflows/.github/workflows/reusable-mqt-core-update.yml@v1.7
2525
with:
2626
update-to-head: ${{ github.event.inputs.update-to-head == 'true' }}

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ repos:
8888

8989
# Format configuration files with prettier
9090
- repo: https://github.com/rbubley/mirrors-prettier
91-
rev: v3.5.2
91+
rev: v3.5.3
9292
hooks:
9393
- id: prettier
9494
types_or: [yaml, markdown, html, css, scss, javascript, json]
@@ -103,10 +103,11 @@ repos:
103103
- nox
104104
- numpy
105105
- pytest
106+
- mqt.core>=3.0.0b5
106107

107108
# Check for spelling
108109
- repo: https://github.com/crate-ci/typos
109-
rev: v1.30.0
110+
rev: v1.30.1
110111
hooks:
111112
- id: typos
112113

@@ -121,7 +122,7 @@ repos:
121122

122123
# Check best practices for scientific Python code
123124
- repo: https://github.com/scientific-python/cookie
124-
rev: 2024.08.19
125+
rev: 2025.01.22
125126
hooks:
126127
- id: sp-repo-review
127128
additional_dependencies: ["repo-review[cli]"]
@@ -136,6 +137,6 @@ repos:
136137

137138
# Check the pyproject.toml file
138139
- repo: https://github.com/henryiii/validate-pyproject-schema-store
139-
rev: 2024.11.25
140+
rev: 2025.02.24
140141
hooks:
141142
- id: validate-pyproject

0 commit comments

Comments
 (0)