From 1e9af7e2f2edbfab8e197843d4ecc8c4c3d87554 Mon Sep 17 00:00:00 2001 From: John Lapeyre Date: Fri, 19 May 2023 11:59:25 -0400 Subject: [PATCH] Deprecate get_vf2_call_limit in preset_passmanagers (#10065) * Deprecate get_vf2_call_limit in preset_passmanagers This has been replaced by get_vf2_limits * Black formatting * Add release note for #10065 --- qiskit/transpiler/preset_passmanagers/common.py | 5 +++++ .../deprecate-get_vf2_call_limit-826e0f9212fb27b9.yaml | 8 ++++++++ test/python/transpiler/test_preset_passmanagers.py | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/deprecate-get_vf2_call_limit-826e0f9212fb27b9.yaml diff --git a/qiskit/transpiler/preset_passmanagers/common.py b/qiskit/transpiler/preset_passmanagers/common.py index e801d04500fc..4645b4ca1385 100644 --- a/qiskit/transpiler/preset_passmanagers/common.py +++ b/qiskit/transpiler/preset_passmanagers/common.py @@ -17,6 +17,7 @@ from typing import Optional from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel +from qiskit.utils.deprecation import deprecate_func from qiskit.transpiler.passmanager import PassManager from qiskit.transpiler.passes import Error @@ -546,6 +547,10 @@ def _require_alignment(property_set): return scheduling +@deprecate_func( + additional_msg="Instead, use :func:`~qiskit.transpiler.preset_passmanagers.common.get_vf2_limits`.", + since="0.25.0", +) def get_vf2_call_limit( optimization_level: int, layout_method: Optional[str] = None, diff --git a/releasenotes/notes/deprecate-get_vf2_call_limit-826e0f9212fb27b9.yaml b/releasenotes/notes/deprecate-get_vf2_call_limit-826e0f9212fb27b9.yaml new file mode 100644 index 000000000000..686ffe004233 --- /dev/null +++ b/releasenotes/notes/deprecate-get_vf2_call_limit-826e0f9212fb27b9.yaml @@ -0,0 +1,8 @@ +--- +deprecations: + - | + The function ``get_vf2_call_limit`` available via the module + :mod:`qiskit.transpiler.preset_passmanagers.common` has been + deprecated. This will likely affect very few users since this function was + neither explicitly exported nor documented. Its functionality has been + replaced and extended by a function in the same module. diff --git a/test/python/transpiler/test_preset_passmanagers.py b/test/python/transpiler/test_preset_passmanagers.py index 55eba7eabb13..e1dc7091aa3d 100644 --- a/test/python/transpiler/test_preset_passmanagers.py +++ b/test/python/transpiler/test_preset_passmanagers.py @@ -19,6 +19,7 @@ import numpy as np +import qiskit from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister from qiskit.circuit import Qubit, Gate, ControlFlowOp, ForLoopOp from qiskit.compiler import transpile, assemble @@ -263,6 +264,11 @@ def counting_callback_func(pass_, dag, time, property_set, count): ) self.assertEqual(gates_in_basis_true_count + 1, collect_2q_blocks_count) + def test_get_vf2_call_limit_deprecated(self): + """Test that calling test_get_vf2_call_limit emits deprecation warning.""" + with self.assertWarns(DeprecationWarning): + qiskit.transpiler.preset_passmanagers.common.get_vf2_call_limit(optimization_level=3) + @ddt class TestTranspileLevels(QiskitTestCase):