demo | docs | install | build |
---|---|---|---|
run Jupyter browser client commands from a CLI, REST API, or other browser windows
See the full documentation on ReadTheDocs.
Note: after installing the browser and server extension, you'll need to restart your server and/or refresh your Jupyter client browser session.
- python >=3.8
- jupyterlab >=3
pip install jyg jupyterlab
mamba install -c conda-forge jyg jupyterlab
... or use conda
if you must.
See the contributing guide for a development install.
Before running any of the above, please ensure you have installed the
jyg
extension for your Jupyter client and server.
- In Advanced Settings: Command Boards
- Create a new Board with a
template
like<button data-command-id="help:licenses">Show Licenses</button>
- or more complicated
<button data-command-id="apputils:change-theme" data-command-args='{"theme": "JupyterLab Dark"}' > Set theme </button>
- Create a new Board with a
- Click the Launcher Item for the board
- Or use the Command Palette
- Click the elements in the board
jyg list --json
jyg ls
jyg l
the following are all equivalent
jyg run filebrowser:open '{"path": "Untitled.ipynb"}'
jyg run filebrowser:open --path=Untitled.ipynb
jyg r filebrowser:open --path Untitled.ipynb
GET http://localhost:8888/jyg/commands
{
"apps": [
{
"url": "http://localhost:8888"
}
]
}
POST http://localhost:8888/jyg/command/docmanager:open
{
"path": "Untitled.ipynb"
}
If various pieces do not appear to be working, try some of the steps below.
jupyter server extension list
jupyter serverextension list
You should see some output that includes:
jyg enabled - Validating jyg... jyg x.x.x OK
If not present, you might be able to re-enable it with:
jupyter server extension enable --sys-prefix --py jyg
jupyter serverextension enable --sys-prefix --py jyg.serverextension
jupyter labextension list
You should see something like:
@deathbeds/jyg vx.x.x enabled OK
Make sure the server is running.
jupyter server list
jupyter notebook list
To run or list commands, the browser must be running the client. Also look at the Browser Console (usually shown with f12) for any explicit errors or warnings.
Sort of. jyg
can list and run commands in JupyterLab-derived apps running as an
extension to the notebook
server... but only when running under jupyter_server<2
.
It cannot (and will not) integrate with the Bootstrap/jQuery notebook UI, as there is consistent design pattern for commands.
Not yet. But it will probably work pretty soon after a release.
No. Aside from the above about notebook<7
. However, the API is extensively typed
and tested, and could be implemented in another backend.
Probably not. Out of the box. jyg
only provides a way to operate its host
application in co-deployed <iframe>
s as Command Boards, and only runs the
postMessage
server when a board is actively running.
The in-browser API is available, however, to create custom extensions which would allow
a web page that already had access to the Jupyter application to register use
postMessage
.
If your application already has control over the Jupyter application, you can likely
use a handle to the Application
instance, get access to the IWindowProxy
plugin, and
add the host window as a source.