Open fleming79 opened 1 year ago
Thanks @fleming79.
The best ref I found sofar was here: https://jupyterlab.readthedocs.io/en/latest/user/commands.html#commands-list
Indeed that would be the best place for documenting what args can be passed. Which I think is auto-generated.
Unfortunately the args
are not all well typed, so not sure it would be easy to add them to the documentation easily.
Likely this would require something like https://github.com/jupyterlab/lumino/issues/58.
Thank you @jtpio for the link to the issue. It looks like the feature (describedBy) may now exist in Lumino, but not yet in Jupyterlab https://github.com/jupyterlab/jupyterlab/issues/13962?
In the meantime it is worth mentioning (for others who may be looking) that it is relatively straight forward to text search the Jupyterlab source code for the command_id
definition with a capable IDE.
As an example; searching in the Jupyterlab source for 'apputils:notify';
) gives one definition:
export const notify = 'apputils:notify';
CTRL + left click
on notify
to follow the link.
app.commands.addCommand(CommandIDs.notify, {
label: trans.__('Emit a notification'),
caption: trans.__(
'Notification is described by {message: string, type?: string, options?: {autoClose?: number | false, actions: {label: string, commandId: string, args?: ReadOnlyJSONObject, caption?: string, className?: string}[], data?: ReadOnlyJSONValue}}.'
),
execute: args => {
const { message, type } = args as any;
const options = (args.options as any) ?? {};
Here we can see the args are 'message' and 'options'. Fortunately 'caption' also provides some useful details about usage.
It looks like the feature (describedBy) may now exist in Lumino, but not yet in Jupyterlab jupyterlab/jupyterlab#13962?
Indeed, it would still need to be implemented in JupyterLab.
In the meantime it is worth mentioning (for others who may be looking) that it is relatively straight forward to text search the Jupyterlab source code for the
command_id
definition with a capable IDE.
Good point. Maybe we should document this in the ipylab repo?
Thank you for providing this module. I'd been looking for a way to open the Jupyter console from python.
Looking through your example notebook I can see you are using args for the commands such as:
. Would it be possible to provide some details on what args can be passed to each of the commands?
The best ref I found sofar was here: https://jupyterlab.readthedocs.io/en/latest/user/commands.html#commands-list however it only lists the commands without arguments.