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

Add notebook extensions for code formatting #37

Closed
Peter9192 opened this issue Jan 29, 2020 · 4 comments · Fixed by #44
Closed

Add notebook extensions for code formatting #37

Peter9192 opened this issue Jan 29, 2020 · 4 comments · Fixed by #44
Assignees
Labels
enhancement New feature or request

Comments

@Peter9192
Copy link
Collaborator

Peter9192 commented Jan 29, 2020

I came across this blog post on notebook extensions. I think particularly point 2 is nice. It adds a button for autopep8 formatting. Perhaps we could use this, or something similar, in our notebook environments.

See the notebook extensions page on RTD. Perhaps also of interest: Code prettify, issuing a call to yapf.

@Peter9192 Peter9192 added the enhancement New feature or request label Jan 29, 2020
@sverhoeven
Copy link
Member

This extension is for the classic notebook env, we are using JupyterLab on https://jupyter.ewatercycle.org.

For JupyterLab there is a similar extension called jupyterlab_code_formatter, it can be installed instead.

@bouweandela
Copy link
Member

@bouweandela
Copy link
Member

For JupyterLab there is a similar extension called jupyterlab_code_formatter, it can be installed instead.

This also supports yapf and isort. It even supports black, so we could also decide to use that instead.

@bouweandela
Copy link
Member

We decided to use black -l 79 -t py36 for now. A suggestion from @nielsdrost for using black from a notebook was: https://github.com/drillan/jupyter-black

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 a pull request may close this issue.

3 participants