pennylane icon indicating copy to clipboard operation
pennylane copied to clipboard

Enable validation against numpy 2.0 release-candidates

Open mlxd opened this issue 10 months ago • 4 comments

Before submitting

Please complete the following checklist when submitting a PR:

  • [ ] All new features must include a unit test. If you've fixed a bug or added code that should be tested, add a test to the test directory!

  • [ ] All new functions and code must be clearly commented and documented. If you do make documentation changes, make sure that the docs build and render correctly by running make docs.

  • [ ] Ensure that the test suite passes, by running make test.

  • [ ] Add a new entry to the doc/releases/changelog-dev.md file, summarizing the change, and including a link back to the PR.

  • [ ] The PennyLane source code conforms to PEP8 standards. We check all of our code against Pylint. To lint modified files, simply pip install pylint, and then run pylint pennylane/path/to/file.py.

When all the above are checked, delete everything above the dashed line and fill in the pull request template.


Context: This Pr allows PennyLane to bee tested with an env-installed numpy 2.0 release candidate. Numpy 2.0 version strings are not compatible with semver, and require so preprocessing to enter the correct form. This will also enable testing against future numpy releases during the dev/rc/post cycles, if published to PyPI.

Description of the Change: As above.

Benefits: Enables testing against numpy dev and RC wheels (post also).

Possible Drawbacks:

Related GitHub Issues:

mlxd avatar Apr 15 '24 18:04 mlxd

Hello. You may have forgotten to update the changelog! Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

github-actions[bot] avatar Apr 15 '24 18:04 github-actions[bot]

[sc-61408]

mlxd avatar Apr 15 '24 18:04 mlxd

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 99.66%. Comparing base (35de283) to head (22fd6bb). Report is 2 commits behind head on master.

Files Patch % Lines
pennylane/numpy/random.py 66.66% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5516      +/-   ##
==========================================
- Coverage   99.67%   99.66%   -0.01%     
==========================================
  Files         404      404              
  Lines       37858    37563     -295     
==========================================
- Hits        37734    37437     -297     
- Misses        124      126       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 15 '24 19:04 codecov[bot]

Probably a good idea to run this PR with the ci:run-full-test-suite label once ready for review.

mudit2812 avatar Apr 16 '24 16:04 mudit2812

@mlxd is there anything more to change in this PR before we can look at the CI runs for testing against numpy 2.0?

trbromley avatar May 15 '24 12:05 trbromley

@mlxd is there anything more to change in this PR before we can look at the CI runs for testing against numpy 2.0?

Just an update to the CI when we want to start. Since a new RC dropped, I'd expect a release to be imminent, so this can be updated now to validate both versions. How we wish to test though is up for discussion, as splitting the entire pipeline into 2.0, and pre-2.0 will be very expensive. Any thoughts @trbromley

mlxd avatar May 17 '24 15:05 mlxd

Currently tensorflow restricts numpy to pre 2.0 in the released wheels (2.16.1). If we aim to install TF on any CI tests it will autodowngrade the version.

mlxd avatar May 17 '24 17:05 mlxd

In addition, we have packages such as https://pypi.org/project/osqp/#files which pin to older scipy, which also limits support for numpy 2.0, as the latest release is not compatible.

mlxd avatar May 17 '24 17:05 mlxd