14

I've read the docs about writing the Jupyter front-end extensions, and learn the examples, and now can build the simple extension by myself.

But - where is a complete docs for Jupyter extensions JavaScript API? How to find the JavaScript API for notebook properties and methods?

3 Answers 3

9

This answer is outdated. Also see my answer below.

This might not be the answer you hoped for. However, it might help some readers being new to JavaScript development.

I also was looking for documentation on the Jupyter (-Notebook) client API and could not find official docs.

The JavaScript source code can be found on the GitHub repository, for example:

What also helped was to

A. Use Google Chrome development tools, set a break point in the extension and type

Jupyter 

in the console. Then you get a browsable tree structure that can be used to inspect the Jupyter object. That tree structure does not seem to contain methods.

B. Log all the properties of an object, including the methods. If you want to know about the methods of the notebook use for example

for(var property in Jupyter.notebook){ console.log(property)}

C. When typing in the console there is code completion. For example you might want to type

Jupyter.notebook.

and see the suggestions on how to complete the command:

enter image description here

Also see

Browsable tree structure in dev tools console:

enter image description here

How to list properties including methods:

enter image description here

...

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

And here is some example code in my project that uses the jupyter notebook: github.com/stefaneidelloth/treezjs/blob/master/src/…
Updated links that demonstrate API usage: JupyterNotebook: github.com/stefaneidelloth/treezjs/blob/master/… JupyterLab: github.com/stefaneidelloth/treezjs/blob/master/…
I'm not able to access the Jupyter variable in Javascript (either in Chrome's console or using ipythons %%javascript tag). Any pointers how to get access to it ? Thanks!
This old answer was related to JupyterNotebook and I guess you use JupyterLab?
3

For newcomers it might be confusing that there are several projects with similar names for historical reasons:

a) Jupyter
https://github.com/jupyter

b) JupyterLab
https://github.com/jupyterlab/

c) The official webpage
https://jupyter.org/
references the newer b).
However, the sub projects of a) do not include deprecation warnings.

=> If you find some documentation via search engine, you have to be careful if its related to a) or b).

Current documentation for JupyterLab extensions can be found here:

Related:

https://www.quora.com/What-is-the-difference-between-JupyterLab-and-Jupyter-Notebook-Is-there-a-use-case-for-one-over-the-other?share=1

https://github.com/jupyterlab/jupyterlab-plugin-playground

Comments

2

Apparently, there are is no front-end API documentation, as there is an open GitHub issue that even references your SO question. Maybe a few +1s on the issue might change this, although I suspect that the answer (if any) will point to JupyterLab, which has a defined front-end API but has no common technical base with Jupyter Notebook front-end extensions.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.