Skip to content

Add download/open in Binder pre-amble for notebooks #2206

@VeckoTheGecko

Description

@VeckoTheGecko

If you want local copies of the notebooks, you can currently download them as a zip of them from our tutorials homepage https://docs.oceanparcels.org/en/latest/documentation/index.html . However:

  • its unusual that someone would want to download all the notebooks (they probably just want to look at one of particular interest)
  • this creating of the zip creates unnecessary complexity in the build process

A better option would be to implement something similar to what xarray has on their gallery page - an autogenerated pre-amble (specified in conf.py) of

Image

Here these are just links (no added complexity to the build process) and has the added benefit of providing a link directly to open in Binder and try the code.


Needed changes:

  • Add pre-amble (Binder link, and "download from GitHub" link)
    • Note: the link should not just point to main - but should depend on the version being built. This prevents downloading the latest notebook when an old version of docs is being looked at. Create a function _get_github_ref_for_build() which returns a GitHub reference/tag/branch name to be interpolated into the string (if "unknown" - e.g., running local - use main). Inspecting READTHEDOCS_VERSION_TYPE and READTHEDOCS_VERSION_NAME environment variables (docs) will help here.
  • Remove zip building workflow

Metadata

Metadata

Assignees

Labels

documentationhackathon2025Good issues for the hackathon at the Parcels anniversary event in 2025.v4

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions