Skip to content
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

Feature Request: Auto Reformat on Execute & Save #17

Open
munro opened this issue Feb 1, 2023 · 2 comments
Open

Feature Request: Auto Reformat on Execute & Save #17

munro opened this issue Feb 1, 2023 · 2 comments

Comments

@munro
Copy link

munro commented Feb 1, 2023

Hello!

I would love if

  • my cell was automatically formatted on save
  • automatically format all cells on save (hopefully this isn't slow, but I guess a dirty flag could be set?)

I'm using VS Code. When I'm working on .py files, VS Code automatically does black formatting (and import sorting!) when I save. I wish I had that in my notebooks in VS Code as well. 🥲

If I have time I may dig into how I add that.

@munro
Copy link
Author

munro commented Feb 1, 2023

Oooo, it looks like it may be really easy, here's how autoreload extension is doing it:

https://stackoverflow.com/questions/32418123/run-code-before-an-ipython-notebook-cell-runs/73722066#73722066

And the pre save hook pre_save_hook!

https://jupyter-notebook.readthedocs.io/en/stable/extending/savehooks.html

@garrettargenna
Copy link

I would love this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants