Skip to content

Commit 0145403

Browse files
committed
Add missing pulse-related deprecation
This commit deprecates `inst_map` in `PassManagerConfig.__init__`. It should have been part of the pulse deprecation PR Qiskit#13164 but I somehow missed to covere it. We're already in our feature freeze period for version 1.3 but since this is not a new feature but rather an addendum to the pulse deprecation PR we should squeeze this in as well.
1 parent 4c3f8c9 commit 0145403

4 files changed

Lines changed: 28 additions & 17 deletions

File tree

crates/circuit/src/dag_circuit.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ impl DAGCircuit {
888888
///
889889
/// Raises:
890890
/// Exception: if the gate is of type string and params is None.
891+
///
892+
/// DEPRECATED since Qiskit 1.3.0 and will be removed in Qiskit 2.0.0
891893
#[pyo3(signature=(gate, qubits, schedule, params=None))]
892894
fn add_calibration<'py>(
893895
&mut self,

qiskit/transpiler/passmanager_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818
from qiskit.transpiler.coupling import CouplingMap
1919
from qiskit.transpiler.instruction_durations import InstructionDurations
20+
from qiskit.utils.deprecate_pulse import deprecate_pulse_arg
2021

2122

2223
class PassManagerConfig:
2324
"""Pass Manager Configuration."""
2425

26+
@deprecate_pulse_arg("inst_map", predicate=lambda inst_map: inst_map is not None)
2527
def __init__(
2628
self,
2729
initial_layout=None,

qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -412,21 +412,28 @@ def generate_preset_pass_manager(
412412
"qubits_initially_zero": qubits_initially_zero,
413413
}
414414

415-
if backend is not None:
416-
pm_options["_skip_target"] = _skip_target
417-
pm_config = PassManagerConfig.from_backend(backend, **pm_options)
418-
else:
419-
pm_config = PassManagerConfig(**pm_options)
420-
if optimization_level == 0:
421-
pm = level_0_pass_manager(pm_config)
422-
elif optimization_level == 1:
423-
pm = level_1_pass_manager(pm_config)
424-
elif optimization_level == 2:
425-
pm = level_2_pass_manager(pm_config)
426-
elif optimization_level == 3:
427-
pm = level_3_pass_manager(pm_config)
428-
else:
429-
raise ValueError(f"Invalid optimization level {optimization_level}")
415+
with warnings.catch_warnings():
416+
# inst_map is deprecated in the PassManagerConfig initializer
417+
warnings.filterwarnings(
418+
"ignore",
419+
category=DeprecationWarning,
420+
message=".*argument ``inst_map`` is deprecated as of Qiskit 1.3",
421+
)
422+
if backend is not None:
423+
pm_options["_skip_target"] = _skip_target
424+
pm_config = PassManagerConfig.from_backend(backend, **pm_options)
425+
else:
426+
pm_config = PassManagerConfig(**pm_options)
427+
if optimization_level == 0:
428+
pm = level_0_pass_manager(pm_config)
429+
elif optimization_level == 1:
430+
pm = level_1_pass_manager(pm_config)
431+
elif optimization_level == 2:
432+
pm = level_2_pass_manager(pm_config)
433+
elif optimization_level == 3:
434+
pm = level_3_pass_manager(pm_config)
435+
else:
436+
raise ValueError(f"Invalid optimization level {optimization_level}")
430437
return pm
431438

432439

releasenotes/notes/deprecate-pulse-package-07a621be1db7fa30.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ deprecations_transpiler:
4343
* :class:`~qiskit.transpiler.passes.EchoRZXWeylDecomposition`
4444
- |
4545
The `inst_map` argument in :func:`~qiskit.transpiler.generate_preset_pass_manager`,
46-
:meth:`~transpiler.target.Target.from_configuration` and :func:`~qiskit.transpiler.preset_passmanagers.common.generate_scheduling`
47-
is being deprecated.
46+
:meth:`~transpiler.target.Target.from_configuration`, :class:`~qiskit.transpiler.PassManagerConfig` initializer
47+
and :func:`~qiskit.transpiler.preset_passmanagers.common.generate_scheduling` is being deprecated.
4848
- |
4949
The `calibration` argument in :func:`~qiskit.transpiler.target.InstructionProperties` initializer methods is being
5050
deprecated.

0 commit comments

Comments
 (0)