Repository: Qiskit/qiskit

Issue:
Deprecate legacy pulse builder command.
### What should we add?

Pulse builder still supports following commands that inject circuit gate operation into the pulse context: 
- `qiskit.pulse.builder.call_gate`
- `qiskit.pulse.builder.cx`
- `qiskit.pulse.builder.u1`
- `qiskit.pulse.builder.u2`
- `qiskit.pulse.builder.u3`
- `qiskit.pulse.builder.x`

These are legacy workflow which we implemented before the pulse gate feature. These command introduce weird cyclic dependency between circuit and pulse program, and must be deprecated before the next release. 

In addition, following commands are nice to be deprecated as well.

- `qiskit.pulse.builder.active_transpiler_settings`
- `qiskit.pulse.builder.active_circuit_scheduler_settings`
- `qiskit.pulse.builder.transpiler_settings`

### Background
Note that the standard program representation in Qiskit is now `QuantumCircuit`, and pulse programs exist as a microcode (calibration) of the circuit. The pulse builder is a tool to define such microprograms, and circuit -> pulse conversion must be explicitly done with the circuit scheduler. Injecting circuit instruction in pulse program is indeed an opposite workflow.


Discussion:
@nkanazawa1989 , should I go ahead with this? If I am allowed to?
Thanks! I just assigned this to you.
Note: An alternative of `pulse.x(q)` will be `pulse.call(backend.target["x"][(q, )].calibration)`.
A PR for this seems to be very straight forward, just deprecated these functions, modify tests and add a release note, that's it!
But, for three days I am banging my head over how this is a type: feature request ?
I tried seeing into other issues/comments by Naoki but didn't get any hint.
Anyways, I am opening this PR #11191 with whatever I know, if I left something please guide me :) 
@itoko , @nkanazawa1989 

Resolving patch:
diff --git a/qiskit/pulse/builder.py b/qiskit/pulse/builder.py
--- a/qiskit/pulse/builder.py
+++ b/qiskit/pulse/builder.py
@@ -116,6 +116,9 @@
 
    decoupled_bell_prep_and_measure.draw()
 
+.. warning::
+    Calling gates directly within the pulse builder namespace is deprecated as of qiskit 0.46.0.
+
 With the pulse builder we are able to blend programming on qubits and channels.
 While the pulse schedule is based on instructions that operate on
 channels, the pulse builder automatically handles the mapping from qubits to
@@ -228,6 +231,9 @@
            with pulse.phase_offset(math.pi, d0):
                pulse.play(gaussian_pulse, d0)
 
+.. warning::
+    Calling gates directly within the pulse builder namespace is deprecated as of qiskit 0.46.0.
+
 The above is just a small taste of what is possible with the builder. See the rest of the module
 documentation for more information on its capabilities.
 
@@ -366,36 +372,6 @@
 .. autofunction:: delay_qubits
 
 
-Circuit Gates
-=============
-
-To use circuit level gates within your pulse program call a circuit
-with :func:`call`.
-
-.. warning::
-    These will be removed in future versions with the release of a circuit
-    builder interface in which it will be possible to calibrate a gate in
-    terms of pulses and use that gate in a circuit.
-
-.. code-block::
-
-    import math
-
-    from qiskit import pulse
-    from qiskit.providers.fake_provider import FakeArmonk
-
-    backend = FakeArmonk()
-
-    with pulse.build(backend) as u3_sched:
-        pulse.u3(math.pi, 0, math.pi, 0)
-
-.. autofunction:: cx
-.. autofunction:: u1
-.. autofunction:: u2
-.. autofunction:: u3
-.. autofunction:: x
-
-
 Utilities
 =========
 
@@ -477,7 +453,7 @@
 from qiskit.pulse.instructions import directives
 from qiskit.pulse.schedule import Schedule, ScheduleBlock
 from qiskit.pulse.transforms.alignments import AlignmentKind
-
+from qiskit.utils.deprecation import deprecate_func, deprecate_arg
 
 #: contextvars.ContextVar[BuilderContext]: active builder
 BUILDER_CONTEXTVAR = contextvars.ContextVar("backend")
@@ -942,6 +918,20 @@ def get_dt(self):
         return self.backend.configuration().dt
 
 
+@deprecate_arg(
+    name="default_transpiler_settings",
+    since="0.46.0",
+    additional_msg="setting parameter ``default_transpiler_settings`` in build() was used for gate "
+    "operations, which are deprecated. pulse schedules should only be used for gate calibrations "
+    "as part of a quantum circuit, and not vice versa",
+)
+@deprecate_arg(
+    name="default_circuit_scheduler_settings",
+    since="0.46.0",
+    additional_msg="setting parameter ``default_circuit_scheduler_settings`` in build() was used "
+    "for gate operations, which are deprecated. pulse schedules should only be used for gate "
+    "calibrations as part of a quantum circuit, and not vice versa",
+)
 def build(
     backend=None,
     schedule: Optional[ScheduleBlock] = None,
@@ -1197,6 +1187,12 @@ def _qubits_to_channels(*channels_or_qubits: Union[int, chans.Channel]) -> Set[c
     return channels
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 def active_transpiler_settings() -> Dict[str, Any]:
     """Return the current active builder context's transpiler settings.
 
@@ -1223,6 +1219,12 @@ def active_transpiler_settings() -> Dict[str, Any]:
     return dict(_active_builder().transpiler_settings)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 def active_circuit_scheduler_settings() -> Dict[str, Any]:
     """Return the current active builder context's circuit scheduler settings.
 
@@ -1507,6 +1509,12 @@ def general_transforms(alignment_context: AlignmentKind) -> ContextManager[None]
         builder.append_subroutine(current)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 @contextmanager
 def transpiler_settings(**settings) -> ContextManager[None]:
     """Set the currently active transpiler settings for this context.
@@ -1540,6 +1548,12 @@ def transpiler_settings(**settings) -> ContextManager[None]:
 
 
 @contextmanager
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 def circuit_scheduler_settings(**settings) -> ContextManager[None]:
     """Set the currently active circuit scheduler settings for this context.
 
@@ -1992,6 +2006,15 @@ def snapshot(label: str, snapshot_type: str = "statevector"):
     append_instruction(instructions.Snapshot(label, snapshot_type=snapshot_type))
 
 
+@deprecate_arg(
+    name="target",
+    since="0.46.0",
+    additional_msg="ScheduleBlock should only be used for gate calibrations in a quantum circuit. "
+    "Thus, the called quantum circuit should be added to the main circuit instead of to the "
+    "ScheduleBlock.",
+    deprecation_description="QuantumCircuit type for the argument target",
+    predicate=lambda qc_arg: isinstance(qc_arg, circuit.QuantumCircuit),
+)
 def call(
     target: Optional[Union[circuit.QuantumCircuit, Schedule, ScheduleBlock]],
     name: Optional[str] = None,
@@ -2167,52 +2190,12 @@ def call(
         The parameter assignment mechanism is available also for schedules.
         However, the called schedule is not treated as a reference.
 
-        3. Calling a quantum circuit
-
-        .. code-block::
-
-            backend = FakeBogotaV2()
-
-            qc = circuit.QuantumCircuit(1)
-            qc.x(0)
-
-            with pulse.build(backend) as pulse_prog:
-                pulse.call(qc)
-
-            print(pulse_prog)
-
-        .. parsed-literal::
-
-            ScheduleBlock(
-                Call(
-                    Schedule(
-                        (
-                            0,
-                            Play(
-                                Drag(
-                                    duration=160,
-                                    amp=(0.18989731546729305+0j),
-                                    sigma=40,
-                                    beta=-1.201258305015517,
-                                    name='drag_86a8'
-                                ),
-                                DriveChannel(0),
-                                name='drag_86a8'
-                            )
-                        ),
-                        name="circuit-87"
-                    ),
-                    name='circuit-87'
-                ),
-                name="block7",
-                transform=AlignLeft()
-            )
-
         .. warning::
 
-            Calling a circuit from a schedule is not encouraged. Currently, the Qiskit execution model
-            is migrating toward the pulse gate model, where schedules are attached to
-            circuits through the :meth:`.QuantumCircuit.add_calibration` method.
+            Calling a circuit from a schedule is deprecated as of qiskit 0.46.0. The Qiskit execution
+            model has migrating toward the pulse gate model, where schedules are attached to circuits
+            through the :meth:`.QuantumCircuit.add_calibration` method. Thus, instead of calling a
+            circuit into the schedule, it should instead be added to the main circuit.
 
     Args:
         target: Target circuit or pulse schedule to call.
@@ -2549,14 +2532,15 @@ def delay_qubits(duration: int, *qubits: Union[int, Iterable[int]]):
 
 
 # Gate instructions
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def call_gate(gate: circuit.Gate, qubits: Tuple[int, ...], lazy: bool = True):
     """Call a gate and lazily schedule it to its corresponding
     pulse instruction.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2602,14 +2586,15 @@ def call_gate(gate: circuit.Gate, qubits: Tuple[int, ...], lazy: bool = True):
     _active_builder().call_gate(gate, qubits, lazy=lazy)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="CXGate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def cx(control: int, target: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.CXGate` on the
     input physical qubits.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2627,14 +2612,15 @@ def cx(control: int, target: int):  # pylint: disable=invalid-name
     call_gate(gates.CXGate(), (control, target))
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="U1Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def u1(theta: float, qubit: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.U1Gate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2654,14 +2640,15 @@ def u1(theta: float, qubit: int):  # pylint: disable=invalid-name
     call_gate(gates.U1Gate(theta), qubit)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="U2Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def u2(phi: float, lam: float, qubit: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.U2Gate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2681,14 +2668,15 @@ def u2(phi: float, lam: float, qubit: int):  # pylint: disable=invalid-name
     call_gate(gates.U2Gate(phi, lam), qubit)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="U3Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def u3(theta: float, phi: float, lam: float, qubit: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.U3Gate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2708,14 +2696,15 @@ def u3(theta: float, phi: float, lam: float, qubit: int):  # pylint: disable=inv
     call_gate(gates.U3Gate(theta, phi, lam), qubit)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="XGate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def x(qubit: int):
     """Call a :class:`~qiskit.circuit.library.standard_gates.XGate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 


Test patch:
diff --git a/test/python/pulse/test_block.py b/test/python/pulse/test_block.py
--- a/test/python/pulse/test_block.py
+++ b/test/python/pulse/test_block.py
@@ -777,7 +777,8 @@ def test_filter_channels_nested_block(self):
                 pulse.delay(5, self.d0)
 
                 with pulse.build(self.backend) as cx_blk:
-                    pulse.cx(0, 1)
+                    with self.assertWarns(DeprecationWarning):
+                        pulse.cx(0, 1)
 
                 pulse.call(cx_blk)
 
diff --git a/test/python/pulse/test_builder.py b/test/python/pulse/test_builder.py
--- a/test/python/pulse/test_builder.py
+++ b/test/python/pulse/test_builder.py
@@ -194,13 +194,15 @@ def test_transpiler_settings(self):
         twice_cx_qc.cx(0, 1)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=0):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=0):
+                    builder.call(twice_cx_qc)
         self.assertNotEqual(len(schedule.instructions), 0)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=3):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=3):
+                    builder.call(twice_cx_qc)
         self.assertEqual(len(schedule.instructions), 0)
 
     def test_scheduler_settings(self):
@@ -219,9 +221,10 @@ def test_scheduler_settings(self):
         x_qc.x(0)
 
         with pulse.build(backend=self.backend) as schedule:
-            with pulse.transpiler_settings(basis_gates=["x"]):
-                with pulse.circuit_scheduler_settings(inst_map=inst_map):
-                    builder.call(x_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(basis_gates=["x"]):
+                    with pulse.circuit_scheduler_settings(inst_map=inst_map):
+                        builder.call(x_qc)
 
         self.assertScheduleEqual(schedule, ref_sched)
 
@@ -606,16 +609,18 @@ def test_qubit_channels(self):
     def test_active_transpiler_settings(self):
         """Test setting settings of active builder's transpiler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_transpiler_settings())
-            with pulse.transpiler_settings(test_setting=1):
-                self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_transpiler_settings())
+                with pulse.transpiler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
 
     def test_active_circuit_scheduler_settings(self):
         """Test setting settings of active builder's circuit scheduler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_circuit_scheduler_settings())
-            with pulse.circuit_scheduler_settings(test_setting=1):
-                self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_circuit_scheduler_settings())
+                with pulse.circuit_scheduler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
 
     def test_num_qubits(self):
         """Test builder utility to get number of qubits."""
@@ -787,7 +792,8 @@ class TestGates(TestBuilder):
     def test_cx(self):
         """Test cx gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.cx(0, 1)
+            with self.assertWarns(DeprecationWarning):
+                pulse.cx(0, 1)
 
         reference_qc = circuit.QuantumCircuit(2)
         reference_qc.cx(0, 1)
@@ -798,8 +804,9 @@ def test_cx(self):
     def test_u1(self):
         """Test u1 gate."""
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(layout_method="trivial"):
-                pulse.u1(np.pi / 2, 0)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(layout_method="trivial"):
+                    pulse.u1(np.pi / 2, 0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.append(circuit.library.U1Gate(np.pi / 2), [0])
@@ -810,7 +817,8 @@ def test_u1(self):
     def test_u2(self):
         """Test u2 gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.u2(np.pi / 2, 0, 0)
+            with self.assertWarns(DeprecationWarning):
+                pulse.u2(np.pi / 2, 0, 0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.append(circuit.library.U2Gate(np.pi / 2, 0), [0])
@@ -821,7 +829,8 @@ def test_u2(self):
     def test_u3(self):
         """Test u3 gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.u3(np.pi / 8, np.pi / 16, np.pi / 4, 0)
+            with self.assertWarns(DeprecationWarning):
+                pulse.u3(np.pi / 8, np.pi / 16, np.pi / 4, 0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.append(circuit.library.U3Gate(np.pi / 8, np.pi / 16, np.pi / 4), [0])
@@ -832,7 +841,8 @@ def test_u3(self):
     def test_x(self):
         """Test x gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.x(0)
+            with self.assertWarns(DeprecationWarning):
+                pulse.x(0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.x(0)
@@ -844,8 +854,9 @@ def test_x(self):
     def test_lazy_evaluation_with_transpiler(self):
         """Test that the two cx gates are optimizied away by the transpiler."""
         with pulse.build(self.backend) as schedule:
-            pulse.cx(0, 1)
-            pulse.cx(0, 1)
+            with self.assertWarns(DeprecationWarning):
+                pulse.cx(0, 1)
+                pulse.cx(0, 1)
 
         reference_qc = circuit.QuantumCircuit(2)
         reference = compiler.schedule(reference_qc, self.backend)
@@ -857,7 +868,8 @@ def test_measure(self):
         ensure agreement."""
         with pulse.build(self.backend) as schedule:
             with pulse.align_sequential():
-                pulse.x(0)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.x(0)
                 pulse.measure(0)
 
         reference_qc = circuit.QuantumCircuit(1, 1)
@@ -872,7 +884,8 @@ def test_backend_require(self):
         """Test that a backend is required to use a gate."""
         with self.assertRaises(exceptions.BackendNotSet):
             with pulse.build():
-                pulse.x(0)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.x(0)
 
 
 class TestBuilderComposition(TestBuilder):
@@ -891,15 +904,18 @@ def test_complex_build(self):
         with pulse.build(self.backend) as schedule:
             with pulse.align_sequential():
                 pulse.delay(delay_dur, d0)
-                pulse.u2(0, pi / 2, 1)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.u2(0, pi / 2, 1)
             with pulse.align_right():
                 pulse.play(library.Constant(short_dur, 0.1), d1)
                 pulse.play(library.Constant(long_dur, 0.1), d2)
-                pulse.u2(0, pi / 2, 1)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.u2(0, pi / 2, 1)
             with pulse.align_left():
-                pulse.u2(0, pi / 2, 0)
-                pulse.u2(0, pi / 2, 1)
-                pulse.u2(0, pi / 2, 0)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.u2(0, pi / 2, 0)
+                    pulse.u2(0, pi / 2, 1)
+                    pulse.u2(0, pi / 2, 0)
             pulse.measure(0)
 
         # prepare and schedule circuits that will be used.
@@ -1027,7 +1043,8 @@ def test_call_gate_and_circuit(self):
                 # this is circuit, a subroutine stored as Call instruction
                 pulse.call(h_control)
                 # this is instruction, not subroutine
-                pulse.cx(0, 1)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.cx(0, 1)
                 # this is macro, not subroutine
                 pulse.measure([0, 1])
 
diff --git a/test/python/pulse/test_builder_v2.py b/test/python/pulse/test_builder_v2.py
--- a/test/python/pulse/test_builder_v2.py
+++ b/test/python/pulse/test_builder_v2.py
@@ -52,13 +52,15 @@ def test_transpiler_settings(self):
         twice_cx_qc.cx(0, 1)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=0):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=0):
+                    builder.call(twice_cx_qc)
         self.assertNotEqual(len(schedule.instructions), 0)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=3):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=3):
+                    builder.call(twice_cx_qc)
         self.assertEqual(len(schedule.instructions), 0)
 
     def test_scheduler_settings(self):
@@ -76,9 +78,10 @@ def test_scheduler_settings(self):
         x_qc.x(0)
 
         with pulse.build(backend=self.backend) as schedule:
-            with pulse.transpiler_settings(basis_gates=["x"]):
-                with pulse.circuit_scheduler_settings(inst_map=inst_map):
-                    builder.call(x_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(basis_gates=["x"]):
+                    with pulse.circuit_scheduler_settings(inst_map=inst_map):
+                        builder.call(x_qc)
 
         self.assertScheduleEqual(schedule, ref_sched)
 
@@ -182,16 +185,18 @@ def test_qubit_channels(self):
     def test_active_transpiler_settings(self):
         """Test setting settings of active builder's transpiler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_transpiler_settings())
-            with pulse.transpiler_settings(test_setting=1):
-                self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_transpiler_settings())
+                with pulse.transpiler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
 
     def test_active_circuit_scheduler_settings(self):
         """Test setting settings of active builder's circuit scheduler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_circuit_scheduler_settings())
-            with pulse.circuit_scheduler_settings(test_setting=1):
-                self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_circuit_scheduler_settings())
+                with pulse.circuit_scheduler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
 
     def test_num_qubits(self):
         """Test builder utility to get number of qubits with backendV2."""
diff --git a/test/python/transpiler/test_calibrationbuilder.py b/test/python/transpiler/test_calibrationbuilder.py
--- a/test/python/transpiler/test_calibrationbuilder.py
+++ b/test/python/transpiler/test_calibrationbuilder.py
@@ -119,45 +119,46 @@ def build_forward(
         duration = self.compute_stretch_duration(u0p_play, theta)
         width = self.compute_stretch_width(u0p_play, theta)
 
-        with builder.build(
-            backend,
-            default_alignment="sequential",
-            default_transpiler_settings={"optimization_level": 0},
-        ) as ref_sched:
-            with builder.align_left():
-                # Positive CRs
-                u0p_params = u0p_play.pulse.parameters
-                u0p_params["duration"] = duration
-                u0p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0p_params),
-                    ControlChannel(0),
-                )
-                d1p_params = d1p_play.pulse.parameters
-                d1p_params["duration"] = duration
-                d1p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1p_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
-            with builder.align_left():
-                # Negative CRs
-                u0m_params = u0m_play.pulse.parameters
-                u0m_params["duration"] = duration
-                u0m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0m_params),
-                    ControlChannel(0),
-                )
-                d1m_params = d1m_play.pulse.parameters
-                d1m_params["duration"] = duration
-                d1m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1m_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
+        with self.assertWarns(DeprecationWarning):
+            with builder.build(
+                backend,
+                default_alignment="sequential",
+                default_transpiler_settings={"optimization_level": 0},
+            ) as ref_sched:
+                with builder.align_left():
+                    # Positive CRs
+                    u0p_params = u0p_play.pulse.parameters
+                    u0p_params["duration"] = duration
+                    u0p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0p_params),
+                        ControlChannel(0),
+                    )
+                    d1p_params = d1p_play.pulse.parameters
+                    d1p_params["duration"] = duration
+                    d1p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1p_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
+                with builder.align_left():
+                    # Negative CRs
+                    u0m_params = u0m_play.pulse.parameters
+                    u0m_params["duration"] = duration
+                    u0m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0m_params),
+                        ControlChannel(0),
+                    )
+                    d1m_params = d1m_play.pulse.parameters
+                    d1m_params["duration"] = duration
+                    d1m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1m_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
         return ref_sched
 
     def build_reverse(
@@ -173,60 +174,60 @@ def build_reverse(
         duration = self.compute_stretch_duration(u0p_play, theta)
         width = self.compute_stretch_width(u0p_play, theta)
 
-        with builder.build(
-            backend,
-            default_alignment="sequential",
-            default_transpiler_settings={"optimization_level": 0},
-        ) as ref_sched:
-            # Hadamard gates
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(SXGate(), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-            builder.call_gate(SXGate(), qubits=(1,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-            with builder.align_left():
-                # Positive CRs
-                u0p_params = u0p_play.pulse.parameters
-                u0p_params["duration"] = duration
-                u0p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0p_params),
-                    ControlChannel(0),
-                )
-                d1p_params = d1p_play.pulse.parameters
-                d1p_params["duration"] = duration
-                d1p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1p_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
-            with builder.align_left():
-                # Negative CRs
-                u0m_params = u0m_play.pulse.parameters
-                u0m_params["duration"] = duration
-                u0m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0m_params),
-                    ControlChannel(0),
-                )
-                d1m_params = d1m_play.pulse.parameters
-                d1m_params["duration"] = duration
-                d1m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1m_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
-            # Hadamard gates
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(SXGate(), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-            builder.call_gate(SXGate(), qubits=(1,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-
+        with self.assertWarns(DeprecationWarning):
+            with builder.build(
+                backend,
+                default_alignment="sequential",
+                default_transpiler_settings={"optimization_level": 0},
+            ) as ref_sched:
+                # Hadamard gates
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(SXGate(), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
+                builder.call_gate(SXGate(), qubits=(1,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
+                with builder.align_left():
+                    # Positive CRs
+                    u0p_params = u0p_play.pulse.parameters
+                    u0p_params["duration"] = duration
+                    u0p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0p_params),
+                        ControlChannel(0),
+                    )
+                    d1p_params = d1p_play.pulse.parameters
+                    d1p_params["duration"] = duration
+                    d1p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1p_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
+                with builder.align_left():
+                    # Negative CRs
+                    u0m_params = u0m_play.pulse.parameters
+                    u0m_params["duration"] = duration
+                    u0m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0m_params),
+                        ControlChannel(0),
+                    )
+                    d1m_params = d1m_play.pulse.parameters
+                    d1m_params["duration"] = duration
+                    d1m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1m_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
+                # Hadamard gates
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(SXGate(), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
+                builder.call_gate(SXGate(), qubits=(1,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
         return ref_sched
 
     @data(-np.pi / 4, 0.1, np.pi / 4, np.pi / 2, np.pi)