-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
releasenotes/notes/remove_provider_abc-87b611c223311a40.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
upgrade_providers: | ||
- | | ||
The abstract base classes ``Provider`` and ``ProviderV1`` have been deprecated since Qiskit 1.1 and they are now removed. | ||
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] |