IPython.notebook methods not available in JupyterLab notebook

In a plain Jupyter notebook, I can call methods from IPython.notebook module or Jupyter.notebook module to perform cell-specific operations. However, when I try using the same code in a notebook within JupyterLab, I get an error saying IPython is not defined or Jupyter is not defined. Is there a way I can access these modules within the notebook in JupyterLab environment?

No, these APIs don’t exist, and generally the application API is intentionally separated more from the what e.g. kernels can generate.

It is possible to configure your jupyterlab application with --expose-app-in-browser, but this it is not something one can generally rely on, and will be a different API altogether, because of the multi-document scope of Lab.

There are a few bridges that offer some additional features, such as ipylab.

2 Likes

Thanks @bollwyvl for the feedback.

I am having a similar need where I would like, from a Python kernel, to access
(read; maybe write) the metadata of the cell being executed. The specific use
case is to exploit interactively the nbgrader cell metadata (how many points will
the student earn if the tests in the cell pass).

I have made some attempts using ipylab, with no success yet (but my javascript
skills are limited!). Any pointers, draft code, or examples welcome!

Thanks in advance!

/cc @jtp

2 Likes