Skip to content

Compatibility layer for IPython / Jupyter globals #6394

@jtpio

Description

@jtpio

Problem

Many Python libraries used in the classic notebook rely on IPython and Jupyter being exposed on window.

This makes porting extensions to JupyterLab / RetroLab a bit difficult since this is not supported anymore.

Proposed Solution

Maybe RetroLab (and only RetroLab) should provide a compat layer and expose window.IPython and window.Jupyter. So things like Jupyter.notebook.save() executed in a JS cell still work in RetroLab by default.

An alternative for now is to use the jupyterapp main application on window with --expose-app-in-browser:

https://github.com/jupyterlab/retrolab/blob/6ce134fa17cc87d79fca822cbb761e4c7237b879/retrolab/app.py#L191-L195

Which can be used to execute arbitrary commands:

window-jupyterapp.mp4

This can be implemented as a new extension in the retrolab repo. The extension would expose the classic notebook API, but call JupyterLab APIs internally.

Additional context

This would help with use cases like ucbds-infra/otter-grader#448

Linking to the custom front-end extension documentation for reference: https://jupyter-notebook.readthedocs.io/en/stable/extending/frontend_extensions.html


cc @yuvipanda @davidwagner @fperez @tonyfast @psychemedia

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions