'Format a Jupyter notebook on save in VSCode

I normally use black to automatically format all of my Python code whenever I save in VSCode. I'd like the same functionality, but within a Jupyter notebook in VSCode.

This answer shows how to right click and format a cell or a whole notebook from the right click context menu, or a keyboard shortcut. Can I make this happen on save instead?

It looks like there is an issue related to this, but it is over a year old.

Are there any good workarounds? Maybe a way to set the format notebook option to the same keybinding as save?



Solution 1:[1]

There are no plans yet according to Github.

I think you can only format it manually.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MingJie-MSFT