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 black notebooks functionality #1761

Merged
merged 1 commit into from Sep 2, 2018

Conversation

2 participants
@Bultako
Member

Bultako commented Aug 31, 2018

This PR is a first attempt to address issue #1756

black_notebooks.py script formats code in notebooks using black Python code formatter.
https://github.com/ambv/black

One issues still not solved is that cells containing %magic commands cannot be formatted.

@cdeil cdeil added the docs label Sep 2, 2018

@cdeil cdeil added this to the 0.8 milestone Sep 2, 2018

@cdeil cdeil added this to To Do in Documentation via automation Sep 2, 2018

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Sep 2, 2018

Member

@Bultako - Thanks!

I tried to find the function / method in IPython or Jupyter that would allow us to split the cell content into lines with % or %% or !, i.e. non Python content, and still apply black to the rest. There's this but I didn't find a working example or try yet. Maybe we should just do something link if '%' in line and only pass the other lines to black?

I'll merge this now and will try it out in master.

Member

cdeil commented Sep 2, 2018

@Bultako - Thanks!

I tried to find the function / method in IPython or Jupyter that would allow us to split the cell content into lines with % or %% or !, i.e. non Python content, and still apply black to the rest. There's this but I didn't find a working example or try yet. Maybe we should just do something link if '%' in line and only pass the other lines to black?

I'll merge this now and will try it out in master.

@cdeil cdeil merged commit 9864519 into gammapy:master Sep 2, 2018

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

Documentation automation moved this from To Do to Done Sep 2, 2018

@Bultako Bultako deleted the Bultako:blacknbs branch Sep 2, 2018

@Bultako

This comment has been minimized.

Show comment
Hide comment
@Bultako

Bultako Sep 2, 2018

Member

%magic commands exceptions solved in e0851fc

Member

Bultako commented Sep 2, 2018

%magic commands exceptions solved in e0851fc

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