Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecating Provider ABC, as abstraction is not very useful #12145

Merged
merged 18 commits into from
Apr 23, 2024
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Matthew Treinish <[email protected]>
  • Loading branch information
1ucian0 and mtreinish authored Apr 19, 2024
commit afa1444e3004d5210c111c9a6da30e7278364646
2 changes: 1 addition & 1 deletion qiskit/providers/fake_provider/generic_backend_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def _setup_sim(self) -> None:
def _default_options(cls) -> Options:
with warnings.catch_warnings(): # TODO remove catch once aer release without Provider ABC
warnings.filterwarnings(
"ignore", category=DeprecationWarning, message=".+ABC Provider and ProviderV1.+"
"ignore", category=DeprecationWarning, message=".+abstract Provider and ProviderV1.+"
)
if _optionals.HAS_AER:
from qiskit_aer import AerSimulator
Expand Down
8 changes: 4 additions & 4 deletions qiskit/providers/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Provider:

@deprecate_func(
since=1.1,
additional_msg="The full ABC Provider and ProviderV1 is deprecated and it is going to"
" be removed in 2.0. Just remove it as a super class.",
additional_msg="The abstract Provider and ProviderV1 classes are deprecated and will"
" be removed in 2.0. You can just remove it as the parent class and a `get_backend` method that returns the backends from `self.backend`.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, there is no need to remove get_backend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I meant when you remove the parent class you should add get_backend back manually. The one method you get for free from the abstract class is get_backend so if people are dropping the abstract class as their parent they'll probably want to add that single method.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oopss! I didnt read it properly, you are right.

)
def __init__(self):
pass
Expand All @@ -45,8 +45,8 @@ class ProviderV1(Provider, ABC):

@deprecate_func(
since=1.1,
additional_msg="The full ABC Provider and ProviderV1 is deprecated and it is going to"
" be removed in 2.0. Just remove it as a super class.",
additional_msg="The abstract Provider and ProviderV1 classes are deprecated and will"
" be removed in 2.0. You can just remove it as the parent class and a `get_backend` method that returns the backends from `self.backend`.",
)
def get_backend(self, name=None, **kwargs):
"""Return a single backend matching the specified filtering.
Expand Down
Loading