Qiskit / qiskit-ibm-runtime

IBM Client for Qiskit Runtime
https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
Apache License 2.0
161 stars 157 forks source link

Don't use fake backend utility functions from Qiskit #2010

Closed jyu00 closed 3 weeks ago

jyu00 commented 4 weeks ago

User reported that importing a fake backend would trigger this deprecation warning:

venv/lib/python3.11/site-packages/qiskit_ibm_runtime/fake_provider/backends/algiers/__init__.py:15: in <module>
    from .fake_algiers import FakeAlgiers
venv/lib/python3.11/site-packages/qiskit_ibm_runtime/fake_provider/backends/algiers/fake_algiers.py:18: in <module>
    from qiskit_ibm_runtime.fake_provider import fake_backend
venv/lib/python3.11/site-packages/qiskit_ibm_runtime/fake_provider/fake_backend.py:34: in <module>
    from qiskit.providers.fake_provider.utils.json_decoder import (
venv/lib/python3.11/site-packages/qiskit/providers/fake_provider/__init__.py:94: in <module>
    from .fake_backend import FakeBackend
venv/lib/python3.11/site-packages/qiskit/providers/fake_provider/fake_backend.py:22: in <module>
    from qiskit.providers.models import BackendProperties
venv/lib/python3.11/site-packages/qiskit/providers/models/__init__.py:80: in __getattr__
    warnings.warn(
E   DeprecationWarning: qiskit.providers.models is deprecated since Qiskit 1.2 and will be removed in Qiskit 2.0. With the removal of Qobj, there is no need for these schema-conformant objects. If you still need to use them, it could be because you are using a BackendV1, which is also deprecated in favor of BackendV2.

Looks like when we ported the backend model classes we didn't also port the decoders:

https://github.com/Qiskit/qiskit-ibm-runtime/blob/3a698111ea8ea9f9c7b341d0e8c6da0ff402dd46/qiskit_ibm_runtime/fake_provider/fake_backend.py#L34-L38

We should already have these decoders in qiskit-ibm-runtime, since we need to decode backend data from the server.

yaelbh commented 4 weeks ago

We should have a way to catch such things in our CI.

jyu00 commented 4 weeks ago

Absolutely. We use to fail test cases that had deprecation warning.