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

Add back qiskit.transpiler.passes.synthesis.graysynth module #9445

Merged
merged 4 commits into from
Jan 24, 2023

Conversation

mtreinish
Copy link
Member

Summary

This commit reverts a breaking change made in #8568, in that PR the graysynth module was moved to the qiskit.synthesis package and the cnot_synth function was also renamed as part of the move. However, this change would break any existing users of the module without any warning. To fix this for the 0.23.0 release this commit adds back the graysynth module and just exports the contents of the module in its new location. Additionally, a small wrapper function is added so that the legacy cnot_synth function name can continue to be used for the time being. In the 0.24.0 cycle we can deprecate the old module and remove them after we've giving users a warning about the change.

Details and comments

This commit reverts a breaking change made in Qiskit#8568, in that PR the
graysynth module was moved to the qiskit.synthesis package and the
cnot_synth function was also renamed as part of the move. However, this
change would break any existing users of the module without any warning.
To fix this for the 0.23.0 release this commit adds back the graysynth
module and just exports the contents of the module in its new location.
Additionally, a small wrapper function is added so that the legacy
cnot_synth function name can continue to be used for the time being. In
the 0.24.0 cycle we can deprecate the old module and remove them after
we've giving users a warning about the change.
@mtreinish mtreinish added priority: high stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: None Do not include in changelog labels Jan 24, 2023
@mtreinish mtreinish added this to the 0.23.0 milestone Jan 24, 2023
@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 the following people are requested to review this:

  • @Qiskit/terra-core

mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Jan 24, 2023
One release note to call out is the release note for Qiskit#8568 has been
changed significantly. This is based on Qiskit#9445 which is reverting some
breaking changes made as part of Qiskit#8568.
Copy link
Member

@kdk kdk left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me. What do you think about reinstating the test for these functions?

@mtreinish
Copy link
Member Author

I think the code is minimal enough here that we don't really need to worry about test coverage. All this is doing is redirecting calls from the old module to the new module and there is only one source of code so we'd essentially be testing python and not our code. That being said apparently this is causing a import cycle in the unit tests (which my manual tests didn't catch). I'll have to use a lazy import to fix this

@mtreinish
Copy link
Member Author

I've changed my mind on the testing it might be effectively one line of code but I made a typo in this so I'll add a test case that exercises the function.

@mtreinish mtreinish requested a review from kdk January 24, 2023 22:13
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4000870400

  • 10 of 10 (100.0%) changed or added relevant lines in 2 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 84.927%

Files with Coverage Reduction New Missed Lines %
src/vf2_layout.rs 1 86.44%
src/sabre_swap/layer.rs 2 98.95%
Totals Coverage Status
Change from base Build 3999824162: 0.03%
Covered Lines: 66719
Relevant Lines: 78560

💛 - Coveralls

@kdk kdk merged commit bf8d6fa into Qiskit:main Jan 24, 2023
mergify bot pushed a commit that referenced this pull request Jan 24, 2023
* Add back qiskit.transpiler.passes.synthesis.graysynth module

This commit reverts a breaking change made in #8568, in that PR the
graysynth module was moved to the qiskit.synthesis package and the
cnot_synth function was also renamed as part of the move. However, this
change would break any existing users of the module without any warning.
To fix this for the 0.23.0 release this commit adds back the graysynth
module and just exports the contents of the module in its new location.
Additionally, a small wrapper function is added so that the legacy
cnot_synth function name can continue to be used for the time being. In
the 0.24.0 cycle we can deprecate the old module and remove them after
we've giving users a warning about the change.

* Restore root qiskit.transpiler.synthesis exports

* Fix import issues

(cherry picked from commit bf8d6fa)
mergify bot added a commit that referenced this pull request Jan 25, 2023
…9446)

* Add back qiskit.transpiler.passes.synthesis.graysynth module

This commit reverts a breaking change made in #8568, in that PR the
graysynth module was moved to the qiskit.synthesis package and the
cnot_synth function was also renamed as part of the move. However, this
change would break any existing users of the module without any warning.
To fix this for the 0.23.0 release this commit adds back the graysynth
module and just exports the contents of the module in its new location.
Additionally, a small wrapper function is added so that the legacy
cnot_synth function name can continue to be used for the time being. In
the 0.24.0 cycle we can deprecate the old module and remove them after
we've giving users a warning about the change.

* Restore root qiskit.transpiler.synthesis exports

* Fix import issues

(cherry picked from commit bf8d6fa)

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
@ShellyGarion
Copy link
Member

ShellyGarion commented Jan 25, 2023

Note that both gray_synth and cnot_synth have never appeared in the Qiskit documentation.

@alexanderivrii
Copy link
Contributor

@mtreinish, thanks for taking care of this. Out of curiosity, did someone complain about the missing functionality? (Shelly and I were under an impression that if something is not mentioned anywhere in the documentation, it can probably be moved or renamed at will).

On a related note, we have also renamed some of the already existing (but not documented) clifford synthesis functions -- can this be a problem?

@mtreinish mtreinish deleted the restore-transpiler-grasynth-module branch January 25, 2023 11:57
@mtreinish
Copy link
Member Author

Note that both gray_synth and cnot_synth have never appeared in the Qiskit documentation.

IMO, this was mostly just an oversight. The module was added in the 0.9.0 release (back then we weren't as careful about the documentation) and the feature was documented as a new feature in the release notes at the time. For cases like this where it's not explicitly marked as internal or private (either with a leading _ or in the docstring) we should err on the side of caution and support the legacy name so if there are existing users they can migrate. I agree with the new location and name make it clearer, but it's very little effort on our part to add the redirects and do this and will avoid users complaining about things breaking for them.

@mtreinish, thanks for taking care of this. Out of curiosity, did someone complain about the missing functionality? (Shelly and I were under an impression that if something is not mentioned anywhere in the documentation, it can probably be moved or renamed at will).

Nobody complained about it afaik (although rc1 usage is typically pretty low so people might not have seen this) but I caught this going through the release notes and it was documented as a breaking change and I couldn't come up with a justification for why it needed to be breaking.

On a related note, we have also renamed some of the already existing (but not documented) clifford synthesis functions -- can this be a problem?

It could be if we weren't explicitly saying they were private or internal it might be best to add backwards compat wrappers to support the old names too.

mergify bot pushed a commit that referenced this pull request Jan 26, 2023
* Prepare 0.23.0 release

This commit prepares the 0.23.0 release, this involves 2 steps first
changing all the version numbers to 0.23.0 from 0.23.0rc1 and secondly
updating the release notes to prepare them for publishing.

One key thing to note is that this PR removes the 0.22.0 release notes.
This is because for the 0.22.0rc1 tag we neglected to move the release
notes to a separate directory. So when we did that for the 0.22.0 final
release we had to forward port this back to main so that any backports
to stable/0.22 would be backportable (see #8901). However, this causes
reno to detect all the 0.22 release notes are incorrectly as part of the
0.23.0 development series. To fix this the simplest path forward was to
remove the 0.22.0 release notes from the 0.23.0 branch (as in this PR).

* Remove backported PRs

* Start editting release note

* More updates

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Fix docs build errors

* More udpates

* Update more release notes

One release note to call out is the release note for #8568 has been
changed significantly. This is based on #9445 which is reverting some
breaking changes made as part of #8568.

* More updates

* Finish feature note first pass

* Start upgrade notes

* Move and update new release notes

* Fix docs build error

* Finish first pass at upgrade notes

* Finish first pass at deprecation notes

* Finish first pass over release notes

* Fix import cycle from dagcircuit

* Apply suggestions from code review

Co-authored-by: Kevin Hartman <kevin@hart.mn>

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

* Update releasenotes/notes/0.23/prepare-0.23.0-release-0d954c91143cf9a4.yaml

* Fix analysis class definition in vf2 release note

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Kevin Hartman <kevin@hart.mn>
Co-authored-by: Jake Lishman <jake@binhbar.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog priority: high stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants