Package: jyg
jygdemodocsinstallbuildrun Jupyter browser client commands from a CLI, REST API, or other browser windowsSee the fulldocumentation on ReadTheDocs.InstallationNote: after installing the browser and server extension, you'll need torestartyour server and/orrefreshyour Jupyter client browser session.Prerequisitespython >=3.8jupyterlab >=3pippipinstalljygjupyterlabmambamambainstall-cconda-forgejygjupyterlab... or usecondaif youmust.Development InstallSee thecontributing guidefor a development install.Quick StartBefore running any of the above, please ensure you haveinstalledthejygextension for your Jupyter client and server.BrowserInAdvanced Settings: Command BoardsCreate a new Board with atemplatelike<buttondata-command-id="help:licenses">Show Licenses</button>or more complicated<buttondata-command-id="apputils:change-theme"data-command-args='{"theme": "JupyterLab Dark"}'>Set theme</button>Click theLauncher Itemfor the boardOr use theCommand PaletteClick the elements in the boardCLIList commandsjyglist--json
jygls
jyglRun commandsthe following are all equivalentjygrunfilebrowser:open'{"path": "Untitled.ipynb"}'jygrunfilebrowser:open--path=Untitled.ipynb
jygrfilebrowser:open--pathUntitled.ipynbREST APIList commandsGET http://localhost:8888/jyg/commands

  {
    "apps": [
      {
        "url": "http://localhost:8888"
      }
    ]
  }Run a commandPOST http://localhost:8888/jyg/command/docmanager:open

  {
    "path": "Untitled.ipynb"
  }TroubleshootingIf various pieces do not appear to be working, try some of the steps below.Verify the installationjupyterserverextensionlist
jupyterserverextensionlistYou should see some output that includes:jyg enabled
  - Validating jyg...
    jyg x.x.x OKIf not present, you might be able to re-enable it with:jupyterserverextensionenable--sys-prefix--pyjyg
jupyterserverextensionenable--sys-prefix--pyjyg.serverextensionjupyterlabextensionlistYou should see something like:@deathbeds/jyg vx.x.x enabled OKVerify the server is runningMake sure the server is running.jupyterserverlist
jupyternotebooklistVerify the browser application is runningTo run or list commands, the browser must be running the client. Also look at theBrowser Console(usually shown withf12) for any explicit errors or
warnings.Frequently Asked QuestionsDoesjygwork with Jupyternotebook<7?Sort of.jygcan list and run commands in JupyterLab-derived apps running as an
extension to thenotebookserver... but only when running underjupyter_server<2.It cannot (and will not) integrate with the Bootstrap/jQuery notebook UI, as there is
consistent design pattern for commands.Doesjygwork with Jupyternotebook>=7?Not yet.But it will probably work pretty soon after a release.Doesjygwork with another backend thanjupyter_server?No.Aside from the above aboutnotebook<7. However, the API is extensively typed
and tested, and could be implemented in another backend.Can$MY_APPLICATIONusejygto drive Jupyter clients?Probably not.Out of the box.jygonly provides a way to operate its host
application in co-deployed<iframe>s asCommand Boards, and only runs thepostMessageserver when a board is actively running.The in-browser API is available, however, to create custom extensions which would allow
a web page thatalreadyhad access to the Jupyter application to register usepostMessage.If your applicationalreadyhas control over the Jupyter application, you can likely
use a handle to theApplicationinstance, get access to theIWindowProxyplugin, and
add the host window as a source.