jupyterlab / extension-examples

JupyterLab Extensions by Examples
BSD 3-Clause "New" or "Revised" License
439 stars 167 forks source link

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

Open paugier opened 1 year ago

paugier commented 1 year ago

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:

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 https://github.com/jupyterlab/extension-examples/issues/202#issuecomment-1186516492

welcome[bot] commented 1 year ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada: