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

Merged
merged 1 commit into from Sep 2, 2018
Merged

Add black notebooks functionality #1761

merged 1 commit into from Sep 2, 2018

Conversation

@Bultako
Copy link
Member

@Bultako 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.

@Bultako Bultako force-pushed the Bultako:blacknbs branch 2 times, most recently from 4053dea to 2585bff Aug 31, 2018
@Bultako Bultako force-pushed the Bultako:blacknbs branch from 2585bff to 81679c6 Aug 31, 2018
@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
Copy link
Member

@cdeil 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
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
Copy link
Member Author

@Bultako 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
Projects
DOCUMENTATION
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants