Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
build-sdist:
name: 🐍 Packaging
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-sdist.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-sdist.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11

# Builds wheels on all supported platforms using cibuildwheel.
# The wheels are uploaded as GitHub artifacts `dev-cibw-*` or `cibw-*`, depending on whether
Expand All @@ -29,7 +29,7 @@ jobs:
windows-2022,
windows-11-arm,
]
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-wheel-cibuildwheel.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-wheel-cibuildwheel.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}

Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
jobs:
change-detection:
name: πŸ” Change
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-change-detection.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-change-detection.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11

cpp-tests-ubuntu:
name: πŸ‡¨β€Œ Test 🐧
Expand All @@ -32,7 +32,7 @@ jobs:
- runs-on: ubuntu-24.04
compiler: gcc
config: Debug
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-tests-ubuntu.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-tests-ubuntu.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}
compiler: ${{ matrix.compiler }}
Expand All @@ -52,7 +52,7 @@ jobs:
- runs-on: macos-14
compiler: clang
config: Debug
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-tests-macos.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-tests-macos.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}
compiler: ${{ matrix.compiler }}
Expand All @@ -72,7 +72,7 @@ jobs:
- runs-on: windows-2022
compiler: msvc
config: Debug
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-tests-windows.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-tests-windows.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}
compiler: ${{ matrix.compiler }}
Expand All @@ -82,7 +82,7 @@ jobs:
name: πŸ‡¨β€Œ Lint
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cpp-linter)
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-linter.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-cpp-linter.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
build-project: true
clang-version: 20
Expand All @@ -107,15 +107,15 @@ jobs:
macos-14,
windows-2022,
]
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-tests.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-tests.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}

python-coverage:
name: 🐍 Coverage
needs: [change-detection, python-tests]
if: fromJSON(needs.change-detection.outputs.run-python-tests)
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-coverage.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-coverage.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
permissions:
contents: read
id-token: write
Expand All @@ -124,13 +124,13 @@ jobs:
name: 🐍 Lint
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-python-tests)
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-linter.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-linter.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11

build-sdist:
name: πŸš€ CD
needs: change-detection
if: fromJSON(needs.change-detection.outputs.run-cd)
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-sdist.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-sdist.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11

build-wheel:
name: πŸš€ CD
Expand All @@ -148,7 +148,7 @@ jobs:
windows-2022,
windows-11-arm,
]
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-wheel-cibuildwheel.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-python-packaging-wheel-cibuildwheel.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-mqt-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
jobs:
update-mqt-core:
name: ⬆️ Update MQT Core
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-mqt-core-update.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-mqt-core-update.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
update-to-head: ${{ github.event.inputs.update-to-head == 'true' }}
secrets:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fail-fast: false
matrix:
runs-on: [ubuntu-24.04, macos-14, windows-2022]
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-qiskit-upstream-tests.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-qiskit-upstream-tests.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
runs-on: ${{ matrix.runs-on }}
setup-z3: true
Expand All @@ -28,7 +28,7 @@ jobs:
name: Create issue on failure
needs: qiskit-upstream-tests
if: ${{ always() }}
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-qiskit-upstream-issue.yml@89734354f64f30a80dd16602d4e271df34348987 # v1.17.4
uses: munich-quantum-toolkit/workflows/.github/workflows/reusable-qiskit-upstream-issue.yml@d6314c45667c131055a0389afc110e8dedc6da3f # v1.17.11
with:
tests-result: ${{ needs.qiskit-upstream-tests.result }}
permissions:
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@ repos:

# Ensure uv lock file is up-to-date
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.9.17
rev: 0.9.22
hooks:
- id: uv-lock

# Python linting using ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.9
rev: v0.14.10
hooks:
- id: ruff-check
- id: ruff-format

# Static type checking using mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.0
rev: v1.19.1
hooks:
- id: mypy
files: ^(python/mqt|test/python|noxfile.py)
Expand All @@ -98,7 +98,7 @@ repos:

# Clang-format the C++ part of the code base automatically
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.7
rev: v21.1.8
hooks:
- id: clang-format
types_or: [c++, c, cuda]
Expand Down Expand Up @@ -151,7 +151,7 @@ repos:

# Check the pyproject.toml file
- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2026.01.02
rev: 2026.01.08
hooks:
- id: validate-pyproject

Expand Down
8 changes: 3 additions & 5 deletions python/mqt/debugger/check/run_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ def estimate_required_shots_from_path(
Returns:
int: The estimated number of shots required for the program.
"""
if isinstance(compiled_program, str):
compiled_program = Path(compiled_program)
with compiled_program.open("r") as f:
program = f.read()
return estimate_required_shots(program, calibration, p_value, num_trials, accuracy)
compiled_program = Path(compiled_program)
program = compiled_program.read_text()
return estimate_required_shots(program, calibration, p_value, num_trials, accuracy)
25 changes: 12 additions & 13 deletions python/mqt/debugger/dap/messages/launch_dap_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ def handle(self, server: DAPServer) -> dict[str, Any]:
dict[str, Any]: The response to the request.
"""
program_path = Path(self.program)
with program_path.open("r", encoding=locale.getpreferredencoding(False)) as f:
code = f.read()
server.source_code = code
try:
server.simulation_state.load_code(code)
except RuntimeError:
return {
"type": "response",
"request_seq": self.sequence_number,
"success": False,
"command": "launch",
"message": "An error occurred while parsing the code.",
}
code = program_path.read_text(encoding=locale.getpreferredencoding(False))
server.source_code = code
try:
server.simulation_state.load_code(code)
except RuntimeError:
return {
"type": "response",
"request_seq": self.sequence_number,
"success": False,
"command": "launch",
"message": "An error occurred while parsing the code.",
}
if not self.stop_on_entry:
server.simulation_state.run_simulation()
server.source_file = {"name": program_path.name, "path": self.program}
Expand Down
7 changes: 3 additions & 4 deletions python/mqt/debugger/dap/messages/restart_dap_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ def handle(self, server: DAPServer) -> dict[str, Any]:
"""
server.simulation_state.reset_simulation()
program_path = Path(self.program)
with program_path.open("r", encoding=locale.getpreferredencoding(False)) as f:
code = f.read()
server.source_code = code
server.simulation_state.load_code(code)
code = program_path.read_text(encoding=locale.getpreferredencoding(False))
server.source_code = code
server.simulation_state.load_code(code)
if not self.stop_on_entry:
server.simulation_state.run_simulation()
server.source_file = {"name": program_path.name, "path": self.program}
Expand Down
4 changes: 2 additions & 2 deletions test/python/test_diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def load_instance(name: str) -> SimulationState:
SimulationState: The generated simulation state.
"""
state = create_ddsim_simulation_state()
with Path(f"test/python/resources/diagnosis/{name}.qasm").open(encoding=locale.getpreferredencoding(False)) as f:
state.load_code(f.read())
code = Path(f"test/python/resources/diagnosis/{name}.qasm").read_text(encoding=locale.getpreferredencoding(False))
state.load_code(code)
return state


Expand Down
8 changes: 4 additions & 4 deletions test/python/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ def load_instance(name: str) -> tuple[SimulationState, ExpectedSolution]:
tuple[SimulationState, ExpectedSolution]: The simulation state and the expected solution.
"""
state = create_ddsim_simulation_state()
with Path(f"test/python/resources/end-to-end/{name}.qasm").open(encoding=locale.getpreferredencoding(False)) as f:
state.load_code(f.read())
with Path(f"test/python/resources/end-to-end/{name}.out").open(encoding=locale.getpreferredencoding(False)) as f:
solution = parse_solution(f.read())
code = Path(f"test/python/resources/end-to-end/{name}.qasm").read_text(encoding=locale.getpreferredencoding(False))
state.load_code(code)
text = Path(f"test/python/resources/end-to-end/{name}.out").read_text(encoding=locale.getpreferredencoding(False))
solution = parse_solution(text)
return (state, solution)


Expand Down
17 changes: 7 additions & 10 deletions test/python/test_python_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@
def simulation_instance_ghz() -> Generator[SimulationInstance, None, None]:
"""Fixture for the GHZ state simulation instance."""
simulation_state = mqt.debugger.create_ddsim_simulation_state()
with Path("test/python/resources/bindings/ghz-incorrect.qasm").open(
code = Path("test/python/resources/bindings/ghz-incorrect.qasm").read_text(
encoding=locale.getpreferredencoding(False)
) as f:
code = f.read()
simulation_state.load_code(code)
)
simulation_state.load_code(code)
yield (simulation_state, 0)
mqt.debugger.destroy_ddsim_simulation_state(simulation_state)

Expand All @@ -45,9 +44,8 @@ def simulation_instance_ghz() -> Generator[SimulationInstance, None, None]:
def simulation_instance_jumps() -> Generator[SimulationInstance, None, None]:
"""Fixture for the Jumps simulation instance."""
simulation_state = mqt.debugger.create_ddsim_simulation_state()
with Path("test/python/resources/bindings/jumps.qasm").open(encoding=locale.getpreferredencoding(False)) as f:
code = f.read()
simulation_state.load_code(code)
code = Path("test/python/resources/bindings/jumps.qasm").read_text(encoding=locale.getpreferredencoding(False))
simulation_state.load_code(code)
yield (simulation_state, 1)
mqt.debugger.destroy_ddsim_simulation_state(simulation_state)

Expand All @@ -56,9 +54,8 @@ def simulation_instance_jumps() -> Generator[SimulationInstance, None, None]:
def simulation_instance_classical() -> Generator[SimulationInstance, None, None]:
"""Fixture for the Classical simulation instance."""
simulation_state = mqt.debugger.create_ddsim_simulation_state()
with Path("test/python/resources/bindings/classical.qasm").open(encoding=locale.getpreferredencoding(False)) as f:
code = f.read()
simulation_state.load_code(code)
code = Path("test/python/resources/bindings/classical.qasm").read_text(encoding=locale.getpreferredencoding(False))
simulation_state.load_code(code)
yield (simulation_state, 2)
mqt.debugger.destroy_ddsim_simulation_state(simulation_state)

Expand Down
Loading