-
Notifications
You must be signed in to change notification settings - Fork 387
Add Option to Clear Notebook Outputs Before Commit #1434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
64fd7a0 to
826b73b
Compare
826b73b to
32411ae
Compare
ec60839 to
e5370b7
Compare
afshin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Meriem!
|
Should we merge this? @Meriem-BenIsmail |
Yes no problem on my end. |
| full_cmd = cmd + options + [full_path] | ||
|
|
||
| # Run the cleaning command | ||
| subprocess.run(full_cmd, check=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be using the existing self.__execute() instead of the blocking subprocess.run()?
| return {"code": code, "message": output.strip()} | ||
|
|
||
| async def check_notebooks_with_outputs(self, path): | ||
| import nbformat, os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports already seem to be listed at the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thanks for noticing.
| const result = await dialog.launch(); | ||
| dialog.dispose(); | ||
|
|
||
| if (result.button.label === this.props.trans.__('Cancel')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use result.button.accept here for the check?
Fixes #392.
This PR introduces an optional workflow to help users keep cleaner Git histories when working with Jupyter notebooks.
When committing, if staged notebooks contain cell outputs, a dialog now appears offering two choices:
Screencast.from.2025-11-27.09-39-48.webm
A new configuration option has been added to the Git extension settings:
When enabled, notebook outputs are automatically stripped before every commit, skipping the dialog entirely.
Implementation Details
Backend endpoints were added to:
nbconvert.