Skip to content

Commit

Permalink
Deprecate BackendData.is_simulator (#1390)
Browse files Browse the repository at this point in the history
No code in qiskit-experiments depends on `is_simulator` already and
`BackendV2` does not provide a standard way to check if a backend uses a
simulator. The code currently tries checking if a backend is a subclass
of some known fake backend classes from qiskit and qiskit-ibm-runtime,
but this code is awkward and seems to be doing something awkward for
little benefit.
  • Loading branch information
wshanks authored Feb 4, 2024
1 parent a87f68c commit b4fc262
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions qiskit_experiments/framework/backend_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class unifies data access for various data fields.
from qiskit.providers import BackendV1, BackendV2
from qiskit.providers.fake_provider import FakeBackend
from qiskit.providers.fake_provider.fake_backend import FakeBackendV2
from qiskit.utils.deprecation import deprecate_func

try:
# Removed in Qiskit 1.0. Different from the other FakeBackendV2's
Expand Down Expand Up @@ -274,6 +275,16 @@ def num_qubits(self):
return None

@property
@deprecate_func(
is_property=True,
since="0.6",
additional_msg=(
"is_simulator is deprecated because BackendV2 does not provide a "
"standard way for checking this property. Calling code must "
"determine if a backend uses a simulator from context."
),
package_name="qiskit-experiments",
) # Note: remove all FakeBackend imports when removing this code
def is_simulator(self):
"""Returns True given an indication the backend is a simulator
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
deprecations:
- |
:attr:`.BackendData.is_simulator` has been deprecated.
:class:`~qiskit.providers.BackendV2` does not provide a standard interface
for determining if a backend uses a simulator. Calling code must determine
if a backend uses a simulator through some other means. Qiskit Experiments
does not treat simulator-backed backends differently from hardware backed
ones.

0 comments on commit b4fc262

Please sign in to comment.