Skip to content

Example how to save the notebook (frontend?) and get path and main metadata of the notebook (from the server side?) #203

@paugier

Description

@paugier

I'd like to have an extension that adds a button (like this) to trigger a command written by the user in the metadata of the notebook.

I guess the command needs to be run on the server side because it uses the .ipynb file. The command needs to be run from the directory containing the ipynb file.

I guess the first step would be to save the notebook to be sure that the file is up to date. I didn't find that in the examples nor in other parts of the documentation (for example here https://jupyterlab.readthedocs.io/en/stable/api/modules/notebook.notebookactions.html).

How can I do that?

Then, I think I need to obtain from the server extension 2 pieces of information:

  • The path of the directory where the notebook is saved
  • A dictionary containing the metadata of the notebook

Is it doable? I wasn't able to find this in the examples.

Additional context

See https://discourse.jupyter.org/t/jupyterlab-extension-to-add-a-button-to-save-the-notebook-and-launch-a-command/14844/3 and #202 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions