Skip to content

Decide whether the theme checks a notebook exists before showing Launch #223

Description

@quantecon-services

Split out of #205, whose acceptance criteria allow this part to be "either implemented as decided, or split into its own issue before this one closes". #205 ships the opt-in configuration change; this issue carries the deferred failsafe.

What #205 already fixes

Launch now renders only when launch_notebook_repo names a notebook repository and launch_colab is true, and nothing is derived from project.github. That removes every dead link we can currently point at:

What is left

A narrower case: a site whose notebooks repository does exist, but where an individual page's notebook is missing from it — or where the repository is renamed or emptied after the build. The maintainer wants a failsafe so Launch never opens a missing notebook.

Three approaches were weighed on #205; the current thinking is the first.

Approach How it works For Against
In-page failsafe (current thinking) Launch starts hidden. A script requests the page's notebook (e.g. HEAD https://raw.githubusercontent.com/<repo>/<branch>/<path>.ipynb) and reveals the control only on success. raw.githubusercontent.com allows cross-origin requests and 404s for a missing repository (checked 2026-09-11) Accurate per page; catches a repository renamed or emptied after the build; no build change One request to GitHub per page view (cacheable for the session); the control appears after load; readers without JavaScript, or where GitHub is blocked, never see it
Build-time check The theme fetches the notebook repository's file list once per build and renders Launch only on pages whose notebook is listed Static, repeatable output; no requests from readers Needs network during the build and a GITHUB_TOKEN in CI (the unauthenticated GitHub API allows 60 requests an hour); goes stale if the repository changes after the build
Notebooks served from the site Notebooks are published with the site (QuantEcon/quantecon-book-theme#359, or the fork's ipynb export), so the build knows which exist No check needed, and no companion repositories Relies on Colab opening a notebook by URL (claimed in QuantEcon/quantecon-book-theme#359, not verified), and on every site publishing its notebooks

Whichever is chosen:

Acceptance criteria

  • The approach is decided and recorded on this issue.
  • Launch is not shown on a page whose notebook cannot be found, and the toolbar takes no gap in its place.
  • The control fails closed: a timeout, a network error or a blocked request leaves it hidden.
  • The hidden state is covered by a test.
  • If the in-page approach is chosen, the docs say that readers without JavaScript see no Launch control.

Context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussOpen-ended team deliberation or a decision to be made

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions