Skip to main content

Main entrypoint for jyg.

Project description

jyg

demo docs install build
binder-badge docs install from pypi install from conda-forge reuse from npm build

run Jupyter browser client commands from a CLI, REST API, or other browser windows

See the full documentation on ReadTheDocs.

Installation

Note: after installing the browser and server extension, you'll need to restart your server and/or refresh your Jupyter client browser session.

Prerequisites

  • python >=3.8
  • jupyterlab >=3

pip

pip install jyg jupyterlab

mamba

mamba install -c conda-forge jyg jupyterlab

... or use conda if you must.

Development Install

See the contributing guide for a development install.

Quick Start

Before running any of the above, please ensure you have installed the jyg extension for your Jupyter client and server.

Browser

  • 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>
      
  • Click the Launcher Item for the board
    • Or use the Command Palette
  • Click the elements in the board

CLI

List commands

jyg list --json
jyg ls
jyg l

Run commands

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

REST API

List commands

GET http://localhost:8888/jyg/commands

  {
    "apps": [
      {
        "url": "http://localhost:8888"
      }
    ]
  }

Run a command

POST http://localhost:8888/jyg/command/docmanager:open

  {
    "path": "Untitled.ipynb"
  }

Troubleshooting

If various pieces do not appear to be working, try some of the steps below.

Verify the installation

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

Verify the server is running

Make sure the server is running.

jupyter server list
jupyter notebook list

Verify the browser application is running

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.

Frequently Asked Questions

Does jyg work with Jupyter notebook<7?

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.

Does jyg work with Jupyter notebook>=7?

Not yet. But it will probably work pretty soon after a release.

Does jyg work with another backend than jupyter_server?

No. Aside from the above about notebook<7. However, the API is extensively typed and tested, and could be implemented in another backend.

Can $MY_APPLICATION use jyg to drive Jupyter clients?

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jyg-0.1.2.tar.gz (349.1 kB view details)

Uploaded Source

Built Distribution

jyg-0.1.2-py3-none-any.whl (430.2 kB view details)

Uploaded Python 3

File details

Details for the file jyg-0.1.2.tar.gz.

File metadata

  • Download URL: jyg-0.1.2.tar.gz
  • Upload date:
  • Size: 349.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for jyg-0.1.2.tar.gz
Algorithm Hash digest
SHA256 44c9ca5a10551689598a17bbd859bbb2ea374ce82f7c30ea72ec05248c02d704
MD5 457398c0dfcfdd336ba9289e20ef4f83
BLAKE2b-256 52c743184c7a0843e69a97b008c1b3728648ed4a6d3d7c8eb7efeeacddc44321

See more details on using hashes here.

File details

Details for the file jyg-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: jyg-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 430.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for jyg-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1109d94448fc452f179ce10248613ed1acd8243238ab3269e09d406de5eda836
MD5 9d8c478ae55ab25ff8d8567cabc70ed9
BLAKE2b-256 fc9997ff9ac7e99ec56b80ca5493620e92d390cb757075a91816ef5c0c8ba94d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page