Jupyter commands

726 views
Skip to first unread message

Peter Cederholm

unread,
Oct 14, 2016, 2:52:22 AM10/14/16
to Project Jupyter
Hi

I have been looking for a complete list of Jupyter commands (like clear_all_output(), execute_cell(), ... and so on). Where/how do I find it? Any clues?

Regards
Peter

Matthias Bussonnier

unread,
Oct 14, 2016, 1:36:21 PM10/14/16
to jup...@googlegroups.com
It's kind of a hackish way but in classical notebooks you can do the
following in a Js Console:

>>> Object.keys(IPython.notebook.keyboard_manager.command_shortcuts.actions._actions)

Which for me give the following:

["jupyter-notebook:restart-kernel",
"jupyter-notebook:confirm-restart-kernel",
"jupyter-notebook:restart-kernel-and-run-all-cells",
"jupyter-notebook:confirm-restart-kernel-and-run-all-cells",
"jupyter-notebook:restart-kernel-and-clear-output",
"jupyter-notebook:confirm-restart-kernel-and-clear-output",
"jupyter-notebook:interrupt-kernel",
"jupyter-notebook:run-cell-and-select-next",
"jupyter-notebook:run-cell",
"jupyter-notebook:run-cell-and-insert-below",
"jupyter-notebook:run-all-cells",
"jupyter-notebook:run-all-cells-above",
"jupyter-notebook:run-all-cells-below",
"jupyter-notebook:enter-command-mode",
"jupyter-notebook:split-cell-at-cursor",
"jupyter-notebook:enter-edit-mode",
"jupyter-notebook:select-previous-cell",
"jupyter-notebook:select-next-cell",
"jupyter-notebook:extend-selection-above",
"jupyter-notebook:extend-selection-below",
"jupyter-notebook:cut-cell", "jupyter-notebook:copy-cell",
"jupyter-notebook:paste-cell-above",
"jupyter-notebook:paste-cell-below",
"jupyter-notebook:insert-cell-above",
"jupyter-notebook:insert-cell-below",
"jupyter-notebook:change-cell-to-code",
"jupyter-notebook:change-cell-to-markdown",
"jupyter-notebook:change-cell-to-raw",
"jupyter-notebook:change-cell-to-heading-1",
"jupyter-notebook:change-cell-to-heading-2",
"jupyter-notebook:change-cell-to-heading-3",
"jupyter-notebook:change-cell-to-heading-4",
"jupyter-notebook:change-cell-to-heading-5",
"jupyter-notebook:change-cell-to-heading-6",
"jupyter-notebook:toggle-cell-output-collapsed",
"jupyter-notebook:toggle-cell-output-scrolled",
"jupyter-notebook:clear-cell-output",
"jupyter-notebook:move-cell-down", "jupyter-notebook:move-cell-up",
"jupyter-notebook:toggle-cell-line-numbers",
"jupyter-notebook:show-keyboard-shortcuts",
"jupyter-notebook:delete-cell", "jupyter-notebook:undo-cell-deletion",
"jupyter-notebook:merge-cell-with-previous-cell",
"jupyter-notebook:merge-cell-with-next-cell",
"jupyter-notebook:merge-selected-cells",
"jupyter-notebook:merge-cells",
"jupyter-notebook:show-command-palette",
"jupyter-notebook:toggle-toolbar", "jupyter-notebook:toggle-header",
"jupyter-notebook:close-pager", "jupyter-notebook:ignore",
"jupyter-notebook:move-cursor-up",
"jupyter-notebook:move-cursor-down",
"jupyter-notebook:scroll-notebook-down",
"jupyter-notebook:scroll-notebook-up",
"jupyter-notebook:scroll-cell-center",
"jupyter-notebook:scroll-cell-top",
"jupyter-notebook:duplicate-notebook",
"jupyter-notebook:trust-notebook", "jupyter-notebook:rename-notebook",
"jupyter-notebook:toggle-all-cells-output-collapsed",
"jupyter-notebook:toggle-all-cells-output-scrolled",
"jupyter-notebook:clear-all-cells-output",
"jupyter-notebook:save-notebook", "jupyter-notebook:find-and-replace",
"widgets:save-widget-state", "widgets:embed-interactive-widgets",
"widgets:save-with-snapshots", "nbpresent:show-sorter",
"nbpresent:show-presentation"]

It's dynamic and may depend (a bit) on your system.

Note that the Js API is not guarantied to be stable.
--
M
> --
> 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+u...@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/ac36e454-89c7-464f-851d-b8f07a096f39%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Peter Cederholm

unread,
Oct 15, 2016, 12:29:50 AM10/15/16
to Project Jupyter
Thank you, Matthias

(: Peter

Jeremy Douglass

unread,
Nov 13, 2016, 3:05:00 PM11/13/16
to Project Jupyter
This was very helpful, thank you Matthias.

For convenience, here is how to dump the list of Jupyter commands to console from a notebooks:

%%javascript
console.log(Object.keys(IPython.notebook.keyboard_manager.command_shortcuts.actions._actions))

...and here is how to print a list of Jupyter commands as notebook cell output:

from IPython.core.display import Javascript

js = """
  var jc_html = "";
  var jc_array = Object.keys(IPython.notebook.keyboard_manager.command_shortcuts.actions._actions);
  for (var i=0;i<jc_array.length;i++) {
    jc_html = jc_html + jc_array[i] + "<br >";
  }
  element.html(jc_html);
  """

Javascript(data=js, lib=None, css=None)
Reply all
Reply to author
Forward
0 new messages