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

Update cirq-core requirement from <1.4.0,>=1.0.0 to >=1.0.0,<1.5.0 #2390

Merged
merged 8 commits into from
Aug 28, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github May 30, 2024

Updates the requirements on cirq-core to permit the latest version.

Release notes

Sourced from cirq-core's releases.

v1.4.0

Cirq v1.4.0 release

Summary

Added support for Python 3.12 and increased minimum Python version to 3.10.

Removal of cirq-ft

The cirq-ft package introduced in 1.2.0 was deleted after its move to the Qualtran repository at https://github.com/quantumlib/Qualtran.git. Please use that repository for fault-tolerant resource estimation needs.

cirq-core

Added cirq.UniformSuperpositionGate for creating uniform superposition from a subset of n-qubit basis states. Added transformer that implements dynamical decoupling for idle moments in a circuit. Added cirq.UNIT_SWEEP as an alias for the cirq.UnitSweep but with a constant-style name. Exposed the Mølmer–Sørensen MSGate at the top level cirq namespace.

cirq-google

Removed functions create_calibration_program and create_batch_program. Added tag class FSimViaModelTag to enable execution of the FSimGate using polynomial model.

A Huge Thank You

Thank you to all our contributors for this release:

Bicheng Ying, Cheng Xing, Dax Fohl, Doug Strain, Eliott Rosenberg, Greg Kahanamoku-Meyer, jbrixon, Josha91, kenya-sk, Lawal Olufowobi, Matthew Harrigan, Matthew Neeley, Miguel Costa, Nour Yosri, Pavol Juhas, Pragya Jain, Prakhar Bhatnagar, Renyi Chen, richrines1, Sam Burdick, Seneca Meeks, Tanuj Khattar, William Courtney, Yury Shefer

What's Changed

ab869790 Flush deprecations before minor release (#6622) a9776d0f Nicer string representation for InverseCompositeGate (#6262) 2cfdf1f4 Add convenience methods to create PhasedXZ gate from ZYZ decomposition (#6569) 1a8caa47 Proper text files end with a newline character (#6614) 778e9e9b Freshen-up cirq dependencies (#6616) e4b6ab2f Fix spurious failure of the check/all script (#6611) ee4d7023 enable simulation of controlled gates in classical simulator (#6589) 528b2d2c Update list of pre-release notebooks (#6609) e11d297b Fix nightly build of the staging cirq website (#6615) f246c2be Add Quantum Engine Support for InternalGate (#6613) aa04196e Create a generalized uniform superposition state gate (#6506)

... (truncated)

Commits
  • ab96766 Fix expected package version in the tests
  • 8aa1725 Removing 1.4.0.dev -> 1.4.0
  • ab86979 Flush deprecations before minor release (#6622)
  • a9776d0 Nicer string representation for InverseCompositeGate (#6262)
  • 2cfdf1f Add convenience methods to create PhasedXZ gate from ZYZ decomposition (#6569)
  • 1a8caa4 Proper text files end with a newline character (#6614)
  • 778e9e9 Freshen-up cirq dependencies (#6616)
  • e4b6ab2 Fix spurious failure of the check/all script (#6611)
  • ee4d702 enable simulation of controlled gates in classical simulator (#6589)
  • 528b2d2 Update list of pre-release notebooks (#6609)
  • Additional commits viewable in compare view

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Updates the requirements on [cirq-core](https://github.com/quantumlib/cirq) to permit the latest version.
- [Release notes](https://github.com/quantumlib/cirq/releases)
- [Changelog](https://github.com/quantumlib/Cirq/blob/main/release.md)
- [Commits](quantumlib/Cirq@v1.0.0...v1.4.0)

---
updated-dependencies:
- dependency-name: cirq-core
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added the infrastructure For issues related to building, packaging, and continuous integration. label May 30, 2024
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.71%. Comparing base (d22df7b) to head (263e9dd).
Report is 47 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2390      +/-   ##
==========================================
- Coverage   98.71%   98.71%   -0.01%     
==========================================
  Files          89       89              
  Lines        4133     4131       -2     
==========================================
- Hits         4080     4078       -2     
  Misses         53       53              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cosenal
Copy link
Contributor

cosenal commented Jun 3, 2024

In mitiq/benchmarks/randomized_benchmarking.py we use _gate_seq_to_mats from 'cirq.experiments.qubit_characterizations' and that function is no longer there in cirq 1.4.0.

In fact, we should not have code that depends on functions (from external modules) that are intended for internal use (single underscore functions).

@bdg221
Copy link
Collaborator

bdg221 commented Jun 3, 2024

Doing a quick search, I also found:

mitiq/benchmarks/mirror_circuits.py uses _single_qubit_cliffords from cirq.experiments.qubit_characterizations.

mitiq/pec/types/types.py uses _format_coefficient from cirq.value.linear_dict

Both of these functions still exist. _format_coefficient has remained the same for 5 years, while _single_qubit_cliffords was slightly updated in January 2024.

@cosenal
Copy link
Contributor

cosenal commented Jun 3, 2024

Thanks, @bdg221. Ideally we want to get rid of all of those cirq internal function calls in Mitiq.

@cosenal cosenal requested review from natestemen and Misty-W and removed request for natestemen and Misty-W June 24, 2024 14:11
@cosenal
Copy link
Contributor

cosenal commented Jun 24, 2024

The solution I implemented in commmit ad9249d in this PR only works with cirq-core>=1.4.0. The solution relies on another internal function, _reduce_gate_seq, which was introduced only in Cirq 1.4.0.

This makes the tests break at the moment. However, if we want to support Python 3.12 and drop Python 3.9, we will want to enforce a dependency to cirq-core>=1.4.0 anyway, in which case commit ad9249d will be a valid solution. This will have to come all together in #2066 (cc @natestemen)

Copy link
Contributor Author

dependabot bot commented on behalf of github Jun 27, 2024

A newer version of cirq-core exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged.

@unitaryfund unitaryfund deleted a comment from dependabot bot Jul 9, 2024
@natestemen
Copy link
Member

From mitiq coding session:

  • bumping minimum cirq requirement to 1.4 would unblock this, despite restricting the range for a core Mitiq requirement. We're testing this approach in 744ded6. This is likely a better solution than reimplementing the cirq internal functions that we currently rely on.

@natestemen natestemen force-pushed the dependabot/pip/cirq-core-gte-1.0.0-and-lt-1.5.0 branch from d5dbb96 to 81ed959 Compare August 27, 2024 22:55
@natestemen natestemen requested a review from cosenal August 28, 2024 05:45
@natestemen
Copy link
Member

After further restricting the cirq version, the documentation was still failing with an error trying to load a pickled cirq.Circuit object. This is due to the fact that the object was pickled at a specific version of cirq that has a different API. See #2107 and in particular e341964 for more details from the last time we faced this issue.

I chose JSON as the replacement as it is the first thing in the cirq docs.

Copy link
Contributor

@cosenal cosenal left a comment

Choose a reason for hiding this comment

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

Thanks for wrapping this up!
By ripple effect of this, we'll be able to upgrade PyQuil to v4 and other dependencies.

with open(f"{file_directory}/rshadows-tutorial-1D_Ising_g=1_{num_qubits}qubits.pkl", "rb") as file:
old_cirq_circuit = pickle.load(file)
circuit = cirq.Circuit(old_cirq_circuit.all_operations())
with open(f"{file_directory}/rshadows-tutorial-1D_Ising_g=1_{num_qubits}qubits.json", "rb") as file:
Copy link
Contributor

Choose a reason for hiding this comment

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

whoa, awesome that we finally got rid of those pickles 🥒

@natestemen natestemen merged commit 6512dbe into main Aug 28, 2024
18 checks passed
@natestemen natestemen deleted the dependabot/pip/cirq-core-gte-1.0.0-and-lt-1.5.0 branch August 28, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure For issues related to building, packaging, and continuous integration.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants