Skip to main content

Sphinx extension that fetches executed Jupyter notebooks and validates/replaces empty source notebooks

Project description

sphinxnotebookgist

sphinxnotebookgist is a Sphinx extension that replaces source-only Jupyter notebooks with executed notebook files during the Sphinx build, after first verifying that the cell sources still match.

What It Does

  • Scans .ipynb files under the Sphinx source directory.
  • Looks for metadata.sphinxnotebookgist.url.
  • Resolves GitHub Gist page URLs to the raw notebook file.
  • Compares local and fetched notebook cell sources.
  • Replaces the local notebook in place when the sources match.

This allows repositories to keep clean notebooks without outputs while still rendering executed outputs in tools such as nbsphinx or myst-nb.

Example Metadata

{
  "metadata": {
    "sphinxnotebookgist": {
      "url": "https://gist.github.com/<user>/<gist_id>"
    }
  }
}

Supported URLs include GitHub Gist page URLs, direct http(s) raw notebook URLs, and local file:// URLs for testing.

Development

python -m pip install -e '.[dev]'
pytest

Run a focused suite with pytest tests/test_unit.py or pytest tests/test_integration.py.

Contributing

Contributor workflow, coding style, and test expectations are documented in AGENTS.md.

Further Reading

Background and motivation for this extension, including a comparison with nbsphinx, are in this post:

https://www.zonca.dev/posts/2026-03-10-sphinxnotebookgist-executed-notebooks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxnotebookgist-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinxnotebookgist-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file sphinxnotebookgist-0.1.0.tar.gz.

File metadata

  • Download URL: sphinxnotebookgist-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for sphinxnotebookgist-0.1.0.tar.gz
Algorithm Hash digest
SHA256 60a8bec4572dd09d12ca8fb3d6e10d1667cf28c377954b857093f6d70c39be29
MD5 82bbdbd4bd5f56ac1ebdf59367a20ee2
BLAKE2b-256 b47956822e48eebd395f9c3ae4b5193cab9a79ad73e68aaca73965fccf72fa87

See more details on using hashes here.

File details

Details for the file sphinxnotebookgist-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinxnotebookgist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92e91016f47c40d28d396d10a7b4124b3209b022b4c3f3e94c6afa5bb3c1ef35
MD5 68382dc1d5b34d3d059922ca213e14e1
BLAKE2b-256 9d392b9c4b056c744e71440206504df3e00baa9b267406d3f3c2ce34c8a184af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page