Skip to content

Conversation

@brichet
Copy link
Collaborator

@brichet brichet commented Nov 7, 2025

This PR allows performing some actions in background, without opening the widget.

Currently the actions that can be performed in the background are:

  • notebook: add cell
  • notebook: delete cell
  • notebook: set cell content
  • notebook: get cell/notebook info
output.webm

Fixes #4

Code change

It adds a background argument to the commands. If true, the tasks create a notebook context instead of opening the widget. When the task is over, the file is saved.
If a widget is already opened, the task doesn't run in the background, it runs in the widget directly, as before.

TODO

  • add a backup of the file, to avoid loosing some content when a task run in background.

@jtpio jtpio added the enhancement New feature or request label Nov 7, 2025
@brichet
Copy link
Collaborator Author

brichet commented Nov 14, 2025

Currently, when running tasks in the background, the file must be saved between each task, to ensure that the change is persistent. If there are several tasks, each task must await the previous one to be executed (and saved), to avoid conflict on the file.

The problem is that there is currently no way to get back to the previous state of the file. Possible options could be (1) to create a backup before each change or (2) to execute the changes in a copy. Then we could display the diff for validation.

The more I think of, the more I wonder if we want this behavior, because at the end we probably want to be able to compare the changes, and so to open a widget for it.

@brichet
Copy link
Collaborator Author

brichet commented Nov 14, 2025

Another option could be to open the document widget without activating it, to prevent the user to be distracted/annoyed by a widget getting the focus. The option should be available from the document manager but seems to not work.
I opened jupyterlab/jupyterlab#18114 to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get/set file content without opening the document widget

2 participants