0.4.0 • Published 9 months ago

jupyterlab_commands v0.4.0

Weekly downloads
70
License
Apache-2.0
Repository
-
Last release
9 months ago

jupyterlab_commands

Support for arbitrary python commands in the command palette.

Build Status GitHub issues Coverage PyPI PyPI npm

About

This code lets you inject arbitrary commands into the JLab frontend. There are a variety of reasons why one might want to execute python commands outside of a notebook and a console:

  • a predefined NBConvert function that you dont want included in the converted result
  • interacting with VCS without including that interaction in the notebook
  • etc...

Installation

pip install jupyterlab_commands
jupyter labextension install jupyterlab_commands
jupyter serverextension enable --py jupyterlab_commands

Example

jupyter_notebook_config.py

def convertMe(request, *args, **kwargs):
    import subprocess, tornado, os, os.path, json
    data = json.loads(tornado.escape.json_decode(request.body))
    path = os.path.join(os.getcwd(), data['path'])
    subprocess.run(["jupyter", "nbconvert", path, '--template', '/Users/theocean154/.jupyter/test.tpl', '--to', 'html'])
    return {'body': 'ok'}

c.JupyterLabCommands.commands = {'sample_command': convertMe}

command palette

npm.io

terminal log

npm.io

No Code

Moved to jupyterlab_nbconvert_nocode npm.io

Install

pip install jupyterlab_commands
jupyter labextension install jupyterlab_commands
jupyter serverextension enable --py jupyterlab_commands

Adding commands

install the server extension, and add the following to jupyter_notebook_config.py

c.JupyterLabCommands.commands = {'command display name': python_function, ...}
0.4.0

9 months ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

3 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.3

4 years ago

0.1.2

5 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago