Targeted DocumentSearch command

In theory, ipylab exposes it for use:

from ipylab import JupyterFrontEnd
from ipywidgets import Output

app = JupyterFrontEnd()
out = Output()

def init():
    # show a slice of the available commands
    cmds = app.commands.list_commands()[53:63]
    out.append_stdout(cmds)

app.on_ready(init)
out

From that code you’ll see currently:

apputils:run-all-enabled
apputils:display-shortcuts
documentsearch:start
documentsearch:startWithReplace
documentsearch:highlightNext
documentsearch:highlightPrevious
documentsearch:end
documentsearch:toggleSearchInSelection
help:about
help:jupyter-forum

I couldn’t quite come up with the proper syntax for a use case example though.


Use of app.on_ready(init) and a hard browser page refrsh to get app.commands.list_commands() to work is discussed in my comment here, which is a comment below a post by Michał Krassowski that has a nice succinct example of ipylab use via python.

That combination of steps should allow the code I provide above to work in MyBinder launches from here at present. After the session spins up and you open a new notebook, then run %pip install ipylab. After that completes, restart the kernel and do a hard refresh. Only after all those steps, should you try the code above.

1 Like