Skip to content

Commit

Permalink
Extend deprecation of QuantumCircuit.duration and DAGCircuit.duration
Browse files Browse the repository at this point in the history
Since we're unlikely to be able to include these removals as part of
Qiskit 2.0.0 given the dependencies on them and that the removals are
not critical for any work we have in the 2.x series this commit opts to
just update the deprecation message to say the removal will occur in
Qiskit 3.0.0 not 2.0.0 like was originally planned.
  • Loading branch information
mtreinish committed Mar 5, 2025
1 parent 65d041b commit 1b84cc7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
8 changes: 4 additions & 4 deletions crates/circuit/src/dag_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ impl DAGCircuit {
/// The total duration of the circuit, set by a scheduling transpiler pass. Its unit is
/// specified by :attr:`.unit`
///
/// DEPRECATED since Qiskit 1.3.0 and will be removed in Qiskit 2.0.0
/// DEPRECATED since Qiskit 1.3.0 and will be removed in Qiskit 3.0.0
#[getter]
fn get_duration(&self, py: Python) -> PyResult<Option<Py<PyAny>>> {
imports::WARNINGS_WARN.get_bound(py).call1((
intern!(
py,
concat!(
"The property ``qiskit.dagcircuit.dagcircuit.DAGCircuit.duration`` is ",
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 2.0.0.",
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0.",
)
),
py.get_type::<PyDeprecationWarning>(),
Expand All @@ -416,15 +416,15 @@ impl DAGCircuit {

/// The unit that duration is specified in.
///
/// DEPRECATED since Qiskit 1.3.0 and will be removed in Qiskit 2.0.0
/// DEPRECATED since Qiskit 1.3.0 and will be removed in Qiskit 3.0.0
#[getter]
fn get_unit(&self, py: Python) -> PyResult<String> {
imports::WARNINGS_WARN.get_bound(py).call1((
intern!(
py,
concat!(
"The property ``qiskit.dagcircuit.dagcircuit.DAGCircuit.unit`` is ",
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 2.0.0.",
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 3.0.0.",
)
),
py.get_type::<PyDeprecationWarning>(),
Expand Down
4 changes: 2 additions & 2 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,7 @@ def __init__(
transpiler and reattach it to the output, so you can track your own metadata."""

@property
@deprecate_func(since="1.3.0", removal_timeline="in Qiskit 2.0.0", is_property=True)
@deprecate_func(since="1.3.0", removal_timeline="in Qiskit 3.0.0", is_property=True)
def duration(self):
"""The total duration of the circuit, set by a scheduling transpiler pass. Its unit is
specified by :attr:`unit`."""
Expand All @@ -1124,7 +1124,7 @@ def duration(self, value: int | float | None):
self._duration = value

@property
@deprecate_func(since="1.3.0", removal_timeline="in Qiskit 2.0.0", is_property=True)
@deprecate_func(since="1.3.0", removal_timeline="in Qiskit 3.0.0", is_property=True)
def unit(self):
"""The unit that :attr:`duration` is specified in."""
return self._unit
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
deprecations_circuits:
- |
The deprecated :attr:`.QuantumCircuit.duration` attribute was not removed
in this release as originally planned, it will be removed as part of the
Qiskit 3.0.0 release instead. This functionality has been superseded
by the :meth:`.QuantumCircuit.estimate_duration` method which should be used
instead.
deprecations_transpiler:
- |
The deprecated :attr:`.DAGCircuit.duration` attribute was not removed
in this release as originally planned, it will be removed as part of the
Qiskit 3.0.0 release instead. This functionality has been superseded
by the :meth:`.QuantumCircuit.estimate_duration` method which should be used
instead.

0 comments on commit 1b84cc7

Please sign in to comment.