Skip to content

Optimize notebooks and use latest climpred#584

Open
Zeitsperre wants to merge 21 commits intomainfrom
optimize-notebooks
Open

Optimize notebooks and use latest climpred#584
Zeitsperre wants to merge 21 commits intomainfrom
optimize-notebooks

Conversation

@Zeitsperre
Copy link
Member

@Zeitsperre Zeitsperre commented Mar 4, 2026

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
  • (If applicable) Documentation has been added / updated (for bug fixes / features).
  • (If applicable) Tests have been added.
  • CHANGELOG.rst has been updated (with summary of main changes).
    • Link to issue (:issue:number) and pull request (:pull:number) has been added.

What kind of change does this PR introduce?

  • Updates the notebooks to address deprecation warnings and errors.
  • Updates climpred and xskillscore to latest versions.
  • Adds a Makefile recipe for discovering all notebooks and running pytest with nbval.
  • Adjusts some notebooks to reduce their execution time:
    • 08_Getting_and_bias_correcting_CMIP6_data.ipynb now skips the execution of the last three cells (a warning is posted in the notebook that these cells are very long to compute already).
    • Perform_a_climate_change_impact_study_on_a_watershed.ipynb no longer sets a numpy random seed (no longer supported in modern versions).
  • Adds a notebook testing workflow that runs on push, pull request, and on Mondays at 9h.
  • Splits the dependencies required to run notebook tests from those needed to render the documentation without running the notebooks.

Does this PR introduce a breaking change?

Yes.

  • The latest xskillscore (v0.0.29) and climpred (v2.6.0) are now required. These versions address several deprecations from xarray and numpy and the packages are generally cleaner. They remain backwards-compatible to Python 3.10.

  • The dependencies found in environment-docs.yml now contain only the dependencies needed for RavenPy and the dependencies needed to render the documentation without running the notebooks. These dependencies should eventually be synchronized with the docs recipe within pyproject.toml

  • The dependencies found in environment-dev.yml now include the dependencies needed to run tests against the notebooks. These dependencies should be added to their own recipe (notebooks) within pyproject.toml.

Other information:

The Makefile is quite out of date and could benefit from several recipes found in other Ouranos projects. After the next cookiecutter update, we should consider addressing this.

The cookiecutter this project is based on has significantly changed the way that non-library dependencies are installed ([dependency-groups] / PEP 735). In the next refresh, the new docs and notebooks dependency lists should be added to this new pyproject.toml entry.

Signed-off-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Signed-off-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Signed-off-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
Signed-off-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
@Zeitsperre Zeitsperre self-assigned this Mar 4, 2026
@Zeitsperre Zeitsperre added dependencies Pull requests that update a dependency file docs labels Mar 4, 2026
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added the CI label Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Note

It appears that this Pull Request modifies the main.yml workflow.

On inspection, the RAVEN_TESTDATA_BRANCH environment variable is set to the most recent tag (v2025.6.12).

No further action is required.

@Zeitsperre Zeitsperre requested a review from huard March 5, 2026 22:13
@Zeitsperre Zeitsperre marked this pull request as ready for review March 5, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI dependencies Pull requests that update a dependency file docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce slow notebook execution times

1 participant