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

Deprecate PrimitivesV1 reference implementations and their utils #12575

Merged
merged 25 commits into from
Jul 25, 2024

Conversation

LeanderCS
Copy link
Contributor

@LeanderCS LeanderCS commented Jun 13, 2024

Fixes #12497

Summary

Deprecate

  • BaseEstimatorV1
  • BaseSamplerV1
  • Estimator
  • Sampler
  • BackendEstimator
  • BackendSampler
  • init_circuit function
  • init_observable function
  • final_measurement_mapping function

Update

  • BasePrimitive docstrings

Details and comments

@LeanderCS LeanderCS requested review from a team as code owners June 13, 2024 21:36
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jun 13, 2024
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core
  • @ajavadia
  • @levbishop
  • @t-imamichi

@t-imamichi t-imamichi added mod: primitives Related to the Primitives module Changelog: Deprecation Include in "Deprecated" section of changelog labels Jun 14, 2024
@jakelishman jakelishman added this to the 1.2.0 milestone Jun 20, 2024
@coveralls
Copy link

coveralls commented Jun 27, 2024

Pull Request Test Coverage Report for Build 9662438342

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

  • 20 of 20 (100.0%) changed or added relevant lines in 9 files are covered.
  • 182 unchanged lines in 8 files lost coverage.
  • Overall coverage decreased (-0.02%) to 89.761%

Files with Coverage Reduction New Missed Lines %
qiskit/circuit/library/generalized_gates/permutation.py 1 92.86%
qiskit/circuit/library/standard_gates/u2.py 1 96.88%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 2 88.2%
qiskit/circuit/library/standard_gates/u3.py 3 96.91%
crates/qasm2/src/lex.rs 4 93.13%
qiskit/circuit/library/standard_gates/u1.py 5 94.85%
crates/circuit/src/circuit_instruction.rs 18 95.81%
crates/circuit/src/operations.rs 148 71.77%
Totals Coverage Status
Change from base Build 9616513556: -0.02%
Covered Lines: 63797
Relevant Lines: 71074

💛 - Coveralls

- Revert BaseSamplerV1 and BaseEstimatorV1
- Deprecate BaseSampler and BaseEstimator

Qiskit#12497 (comment)
@t-imamichi
Copy link
Member

I asked some questions about the agreement #12497 (comment). So, let's wait for answers about other base classes and the result classes.

@t-imamichi
Copy link
Member

I reverted SamplerResult, EstimatorResult and BasePrimitive.

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the changes @t-imamichi, the deprecated classes seem to follow the recent discussion outcomes. The only missing point is fixing the current lint complaint, which I believe might require modifying the primitives __init__ to deal with the BaseEstimator/BaseSampler alias import (probably re-raising the warning in the __init__? you may be able to find a better solution than me)

@t-imamichi
Copy link
Member

t-imamichi commented Jul 25, 2024

I thought the revised version of BaseSampler and BaseEstimator was smarter (copied #11054). But as CI showed, it caused complicated import issues. It's not easy for me to resolve because BaseSampler and BaseEstimator are imported by qiskit.primitives.__init__.py and qiskit.primitives.bases.__init__.py. I don't think it's a good idea to update all init files.
So, I reverted the change. I check pylint locally. I hope CI passes finally.

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the effort taking the PR past the finish line!

@ElePT ElePT enabled auto-merge July 25, 2024 14:20
@ElePT ElePT added this pull request to the merge queue Jul 25, 2024
Merged via the queue into Qiskit:main with commit 250acc3 Jul 25, 2024
15 checks passed
@1ucian0 1ucian0 changed the title Deprecate V1 Primitives and their utils Deprecate non-versioned Primitives and their utils Jul 25, 2024
@1ucian0 1ucian0 changed the title Deprecate non-versioned Primitives and their utils Deprecate non-versioned Primitives Jul 25, 2024
@1ucian0 1ucian0 changed the title Deprecate non-versioned Primitives Deprecate PrimitivesV1 reference implementations and their utils Jul 26, 2024
Procatv pushed a commit to Procatv/qiskit-terra-catherines that referenced this pull request Aug 1, 2024
* Deprecate V1 Primitives and their utils

* Fix tests

* Fix yaml error

* Fix build

* Fix error after mc

* Fix error after mc

* Apply comments

* Use correct deprecate version for warning message

* Update deprecation messages

* Add missed ``

* update releasenote

* Deprecate SamplerResult and EstimatorResult

* fix deprecation warning for SamplerResult and EstimatorResult

* apply review comments

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* Applying the agreement of deprecations.

- Revert BaseSamplerV1 and BaseEstimatorV1
- Deprecate BaseSampler and BaseEstimator

Qiskit#12497 (comment)

* revert SamplerResult, EstimatorResult, and BasePrimitiveResult

* fix test_backend_sampler

* revert tox.ini

* revise deprecation warning for BaseSampler and BaseEstimator

* update reno

* revert BaseSampler and BaseEstimator

---------

Co-authored-by: Takashi Imamichi <imamichi@jp.ibm.com>
Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
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 Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: primitives Related to the Primitives module priority: high
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Deprecate v1 primitives
8 participants