sphinx_gallery.interactive_example#
Binder and Jupyterlite utility functions.
Integration with Binder and Jupyterlite is on an experimental stage. Note that this API may change in the future.
Warning
Binder is still beta technology, so there may be instability in the experience of users who click Binder links.
Functions#
- sphinx_gallery.interactive_example.check_binder_conf(binder_conf: dict[str, Any] | None) dict[str, Any][source]#
Check to make sure that the Binder configuration is correct.
- sphinx_gallery.interactive_example.check_jupyterlite_conf(jupyterlite_conf: dict[str, Any] | None, app: Sphinx | None) dict[str, Any] | None[source]#
Return full JupyterLite configuration with defaults.
- sphinx_gallery.interactive_example.copy_binder_files(app: Sphinx, exception: Exception | None) None[source]#
Copy all Binder requirements and notebooks files.
- sphinx_gallery.interactive_example.create_jupyterlite_contents(app: Sphinx, exception: Exception | None) None[source]#
Create Jupyterlite contents according to âjupyterliteâ configuration.
- sphinx_gallery.interactive_example.gen_binder_rst(fpath: str | os.PathLike, binder_conf: dict[str, Any], gallery_conf: GalleryConfig) str[source]#
Generate the reST + link for the Binder badge.
- Parameters:
fpath (str) â The path to the .py file for which a Binder badge will be generated.
binder_conf (dict) â
A dictionary with the following keys:
- âbinderhub_urlâ
The URL of the BinderHub instance thatâs running a Binder service.
- âorgâ
The GitHub organization to which the documentation will be pushed.
- ârepoâ
The GitHub repository to which the documentation will be pushed.
- âbranchâ
The Git branch on which the documentation exists (e.g., gh-pages).
- âdependenciesâ
A list of paths to dependency files that match the Binderspec.
gallery_conf (dict) â Sphinx-Gallery configuration dictionary.
- Returns:
rst â The reStructuredText for the Binder badge that links to this file.
- Return type:
- sphinx_gallery.interactive_example.gen_binder_url(fpath: str | os.PathLike, binder_conf: dict[str, Any], gallery_conf: GalleryConfig) str[source]#
Generate a Binder URL according to the configuration in conf.py.
- Parameters:
- Returns:
binder_url â A URL that can be used to direct the user to the live Binder environment.
- Return type:
- sphinx_gallery.interactive_example.gen_jupyterlite_rst(fpath: str | os.PathLike, gallery_conf: GalleryConfig) str[source]#
Generate the reST + link for the Binder badge.
- Parameters:
fpath (str | os.PathLike) â The path to the .py file for which a JupyterLite badge will be generated.
gallery_conf (dict) â Sphinx-Gallery configuration dictionary.
- Returns:
rst â The reStructuredText for the JupyterLite badge that links to this file.
- Return type:
- sphinx_gallery.interactive_example.post_configure_jupyterlite_sphinx(app: Sphinx, config: Config) None[source]#
Check SG âjupyterliteâ and update Jupyterlite config âjupyterlite_contentsâ.
Connected to âconfig-initedâ event but lower priority so called after pre_configure_jupyterlite_sphinx.