Modifying the Dynamic Buttons in the Notebook Server

59 views
Skip to first unread message

Ian Stuart

unread,
Jan 25, 2018, 10:50:39 AM1/25/18
to Project Jupyter
I have a need to write an extension to the notebook server which is triggered by a button in the  dynamic-buttons div.

There are two, maybe three, parts to this question.

1) I've read http://mindtrove.info/4-ways-to-extend-jupyter-notebook/#nb-server-exts - but where does this code & how do I install it?

2) Are there any examples of Server extensions I can explore?

3) Is there any more expansive documentation? ---- for the server extensions, not the notebook extensions

Cheers.

Thomas Kluyver

unread,
Jan 27, 2018, 5:04:21 AM1/27/18
to Project Jupyter
On 25 January 2018 at 16:50, 'Ian Stuart' via Project Jupyter <jup...@googlegroups.com> wrote:
1) I've read http://mindtrove.info/4-ways-to-extend-jupyter-notebook/#nb-server-exts - but where does this code & how do I install it?

The code goes anywhere that it can be imported from Python - typically you'd make a package which can be installed with pip.
 
2) Are there any examples of Server extensions I can explore?


 
3) Is there any more expansive documentation? ---- for the server extensions, not the notebook extensions

Ian Stuart

unread,
Jan 29, 2018, 3:31:14 AM1/29/18
to jup...@googlegroups.com
On 27 January 2018 at 10:03, Thomas Kluyver <tak...@gmail.com> wrote:
On 25 January 2018 at 16:50, 'Ian Stuart' via Project Jupyter <jup...@googlegroups.com> wrote:
2) Are there any examples of Server extensions I can explore?

Cite2c adds some URL handlers with a server extension:
These seem to be handlers within the notebook itself - I'm looking to add handlers for actions in the _tree_ page (ie, when I user selects a file/directory, an additional button appears [depending on stuff, which I need to code]

Thankee....


--
Ian

Thomas Kluyver

unread,
Jan 29, 2018, 4:21:25 AM1/29/18
to Project Jupyter
If you want to do things in the Javascript, that's a notebook extension (aka nbextension) rather than a server extension. You might need a corresponding server extension for your new buttons to talk to (cite2c is an example of an extension that contains both an nbextension and a server extension).

Here's an example of an extension modifying the tree view:
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/tree-filter/readme.html
https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/tree-filter/index.js

It works the same way as an nbextension modifying the notebook page, but you have to make sure it's enabled for the tree view.

Thomas

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAKofB1LeB1jRFZh6CFOFBT6KbB_gjAmemEP7_idqjoRJ5zEOdA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Ian Stuart

unread,
Jan 29, 2018, 4:31:14 AM1/29/18
to jup...@googlegroups.com
On 29 January 2018 at 09:20, Thomas Kluyver <tak...@gmail.com> wrote:
If you want to do things in the Javascript, that's a notebook extension (aka nbextension) rather than a server extension. You might need a corresponding server extension for your new buttons to talk to (cite2c is an example of an extension that contains both an nbextension and a server extension).

Here's an example of an extension modifying the tree view:
http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/tree-filter/readme.html
https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/tree-filter/index.js

It works the same way as an nbextension modifying the notebook page, but you have to make sure it's enabled for the tree view.

Spot on!
Thank you...
 


--
Ian
Reply all
Reply to author
Forward
0 new messages