Skip to content

Commit

Permalink
Limit QPY version when generating circuits for compatibility test
Browse files Browse the repository at this point in the history
Fix some doc issues
  • Loading branch information
eliarbel committed Feb 9, 2025
1 parent 39d12b4 commit ddb4f56
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion qiskit/qpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def open(*args):
it to QPY setting ``use_symengine=False``. The resulting file can then be loaded by any later
version of Qiskit.
With the removal of Pulse in Qiskit 2.0, QPY does not support loading ``ScheduleBlock` programs
With the removal of Pulse in Qiskit 2.0, QPY does not support loading ``ScheduleBlock`` programs
or pulse gates. If such payloads are being loaded, QPY will issue a warning and
return partial circuits. In the case of a ``ScheduleBlock`` payload, a circuit with only a name
and metadata will be loaded. It the case of pulse gates, the circuit will contain custom
Expand Down
1 change: 0 additions & 1 deletion qiskit/qpy/binary_io/schedules.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
payloads containing pulse gates without breaking the load flow.
The purpose of the `_read` and `_load` methods below is just to advance
the file handle while consuming pulse data."""
from curses import meta
import json
import struct
import zlib
Expand Down
6 changes: 3 additions & 3 deletions releasenotes/notes/remove-pulse-qpy-07a96673c8f10e38.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
upgrade_qpy:
- |
With the removal of Pulse in Qiskit 2.0, support for serializing ``ScheduleBlock` programs
With the removal of Pulse in Qiskit 2.0, support for serializing ``ScheduleBlock`` programs
via the :func:`qiskit.qpy.dump` function has been removed. Furthermore, in order to keep
backward compatibility, users can still load payloads containing pulse data (i.e. either
`ScheduleBlock`s or containing pulse gates) using the :func:`qiskit.qpy.load` function.
``ScheduleBlock`` s or containing pulse gates) using the :func:`qiskit.qpy.load` function.
However, pulse data is ignore, resulting with potentially partially specified circuits.
In particular, loading a ``ScheduleBlock`` payload will result with a circuit having only
a name and metadata. Loading a :class:`~QuantumCircuit` payload with pulse gates will
a name and metadata. Loading a :class:`~.QuantumCircuit` payload with pulse gates will
result with a circuit containing undefined custom instructions.
7 changes: 4 additions & 3 deletions test/qpy_compat/test_qpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,18 +848,19 @@ def generate_circuits(version_parts):
]
if version_parts >= (0, 19, 2):
output_circuits["control_flow.qpy"] = generate_control_flow_circuits()
if version_parts >= (0, 21, 0):
if version_parts >= (0, 21, 0) and version_parts < (2, 0, 0):
output_circuits["schedule_blocks.qpy"] = generate_schedule_blocks()
output_circuits["pulse_gates.qpy"] = generate_calibrated_circuits()
if version_parts >= (0, 24, 0):
if version_parts >= (0, 24, 0) and version_parts < (2, 0, 0):
output_circuits["referenced_schedule_blocks.qpy"] = generate_referenced_schedule()
if version_parts >= (0, 24, 0):
output_circuits["control_flow_switch.qpy"] = generate_control_flow_switch_circuits()
if version_parts >= (0, 24, 1):
output_circuits["open_controlled_gates.qpy"] = generate_open_controlled_gates()
output_circuits["controlled_gates.qpy"] = generate_controlled_gates()
if version_parts >= (0, 24, 2):
output_circuits["layout.qpy"] = generate_layout_circuits()
if version_parts >= (0, 25, 0):
if version_parts >= (0, 25, 0) and version_parts < (2, 0, 0):
output_circuits["acquire_inst_with_kernel_and_disc.qpy"] = (
generate_acquire_instruction_with_kernel_and_discriminator()
)
Expand Down

0 comments on commit ddb4f56

Please sign in to comment.