Skip to content

Add option to generate interactive gallery with replite #927

Closed

Description

@ianhi

Proposal

Add an option to use jupyterlite to have make a gallery of interactive examples.

How

Using jupyterlite it's now possible to have interactive python repl on a webpage without a backing from binder. https://jupyterlite-sphinx.readthedocs.io/en/latest/directives/replite.html provides a :replite: sphinx directive that enables this. Naively I'd expect that replacing the ..code-block:: with :replite might just give automatic interactivity.

There be some work to get examples with multiple code blocks to share the same kernel between them, but even if this was just enabld for examples wiht single code blocks that would be amazing!

cc @jtpio @martinRenou

Activity

  1. amueller commented on Jul 16, 2022

    @amueller
    Contributor

    Is the idea that you can configure whether to add a "run in jupyterlite" to the bottom next to the download buttons? Or potentially replace the default example rendering with an interactive one? [also the link above is broken]

  2. ianhi commented on Jul 16, 2022

    @ianhi
    Author

    updated the link.

    "run in jupyterlite" to the bottom next to the download buttons? Or potentially replace the default example rendering with an interactive one?

    I think having an option for both would be good!

  3. amueller commented on Jul 16, 2022

    @amueller
    Contributor

    The :replite: seems to provide more of a repl-like experience (as might be gathered from the name), so you can't edit the example and run again. You can copy & paste the example code but that was a bit confusing for me.

  4. ianhi commented on Jul 16, 2022

    @ianhi
    Author

    True, I think a better thing would be to use retrolite: https://jupyterlite-sphinx.readthedocs.io/en/latest/directives/retrolite.html which embeds a mini retrolab (now notebook classic i think?)

  5. amueller commented on Jul 16, 2022

    @amueller
    Contributor

    Yes, but then I don't think they would share state across multiple cells. I'm thinking we might be able to get a separate page to have a full jupyterlab that can then share the jupyterlite instance for all examples which you can browse.
    Right now it looks like this but maybe I can make it open in another window instead of an iframe:
    image

  6. jtpio commented on Jul 18, 2022

    @jtpio

    maybe I can make it open in another window instead of an iframe

    Yes, for example ipycanvas does this by providing a badge on the docs landing page: https://ipycanvas.readthedocs.io/en/latest/?badge=latest

  7. Borda commented on Apr 23, 2024

    @Borda
    Contributor

    Just thinking, what about some form of ipywidgets with precomputed steps?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions