qiskit/releasenotes/notes/1.1/deprecate_providerV1-ba17d7...

19 lines
1.0 KiB
YAML

---
deprecations_providers:
- |
The abstract base classes ``Provider`` and ``ProviderV1`` are now deprecated and will be removed in Qiskit 2.0.0.
The abstraction provided by these interface definitions were not providing a huge value. solely just the attributes
``name``, ``backends``, and a ``get_backend()``. A _provider_, as a concept, will continue existing as a collection
of backends. If you're implementing a provider currently you can adjust your
code by simply removing ``ProviderV1`` as the parent class of your
implementation. As part of this you probably would want to add an
implementation of ``get_backend`` for backwards compatibility. For example::
def get_backend(self, name=None, **kwargs):
backend = self.backends(name, **kwargs)
if len(backends) > 1:
raise QiskitBackendNotFoundError("More than one backend matches the criteria")
if not backends:
raise QiskitBackendNotFoundError("No backend matches the criteria")
return backends[0]