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

Conversation

1ucian0
Copy link
Member

@1ucian0 1ucian0 commented Apr 5, 2024

Summary

The abstraction Provider (and ProviderV1) does not give you much: name, backends, and/or get_backend. That's it. And one of those (get_backend) is debatable in name.

A provider is a collection of backends. Backend is the actual thing that Qiskit cares about. Providers are not structures that Qiskit handles around (like it used to Qiskit/qiskit-ibm-runtime#419), so there is no need to prescribe a specific API. Different providers have, for example, different credential handling. So having a different way to fetch a backend looks like minor to me. If you think the discussion is controversial enough, I could open a short RFC.

Details and comments

see also: #5629

@1ucian0 1ucian0 requested review from jyu00 and a team as code owners April 5, 2024 11:34
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@1ucian0 1ucian0 added Changelog: None Do not include in changelog Changelog: Deprecation Include in "Deprecated" section of changelog and removed Changelog: None Do not include in changelog labels Apr 5, 2024
@1ucian0 1ucian0 requested a review from a team as a code owner April 5, 2024 12:01
@coveralls
Copy link

coveralls commented Apr 5, 2024

Pull Request Test Coverage Report for Build 8802208992

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 10 of 11 (90.91%) changed or added relevant lines in 2 files are covered.
  • 411 unchanged lines in 35 files lost coverage.
  • Overall coverage decreased (-0.06%) to 89.289%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/providers/fake_provider/generic_backend_v2.py 5 6 83.33%
Files with Coverage Reduction New Missed Lines %
qiskit/synthesis/two_qubit/xx_decompose/circuits.py 1 92.86%
qiskit/circuit/store.py 1 94.29%
qiskit/primitives/containers/data_bin.py 1 97.92%
qiskit/circuit/parameter.py 1 98.39%
qiskit/synthesis/linear/cnot_synth.py 1 98.0%
qiskit/circuit/library/blueprintcircuit.py 2 95.16%
qiskit/qasm2/init.py 2 93.55%
qiskit/qasm3/init.py 2 95.0%
qiskit/transpiler/passes/routing/sabre_swap.py 2 96.82%
qiskit/synthesis/two_qubit/xx_decompose/decomposer.py 2 90.63%
Totals Coverage Status
Change from base Build 8563426649: -0.06%
Covered Lines: 60381
Relevant Lines: 67624

💛 - Coveralls

@1ucian0 1ucian0 added this to the 1.1.0 milestone Apr 10, 2024
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

Overall this LGTM, I left a couple small comments on the deprecation message but otherwise the current content of this PR looks good.

The only thing missing is a release note documenting and explaining the reasoning behind the deprecation of the classes.

qiskit/providers/provider.py Outdated Show resolved Hide resolved
qiskit/providers/provider.py Outdated Show resolved Hide resolved
qiskit/providers/provider.py Outdated Show resolved Hide resolved
Co-authored-by: Matthew Treinish <[email protected]>
@deprecate_func(
since=1.1,
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.

mtreinish
mtreinish previously approved these changes Apr 22, 2024
@mtreinish mtreinish enabled auto-merge April 22, 2024 19:39
@mtreinish mtreinish added this pull request to the merge queue Apr 23, 2024
Merged via the queue into Qiskit:main with commit 4d95d94 Apr 23, 2024
12 checks passed
github-merge-queue bot pushed a commit to qiskit-community/qiskit-experiments that referenced this pull request Apr 26, 2024
`Aer.get_backend()` was deprecated as part of the `Provider` abstract
class deprecation in Qiskit/qiskit#12145. This
PR replaces it with instantiating `AerSimulator()` directly so the cron
CI tests can pass again.

---------

Co-authored-by: Will Shanks <[email protected]>
1ucian0 added a commit to 1ucian0/qiskit-terra that referenced this pull request Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Deprecation Include in "Deprecated" section of changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants