Make git reviews easier: Set up auto-exporting scripts from notebook files on save#57
Merged
Make git reviews easier: Set up auto-exporting scripts from notebook files on save#57
Conversation
Add Jupyter configs to automatically export a script file whenever a Jupyter Notebook file (.ipynb) in the repo is saved. This makes diffing changes in git significantly easier. The files are exported to a top-level directory called .nbexports, which mirrors the filepaths of the real files. (Note, when scripts are renamed / deleted, it will require manual cleanup from the .nbexports directory)
Explains that for contributing to this repo, you should start Jupyter from the top-level of this repo direcotory in order to make sure jupyter picks up our configuration files.
Ran:
```julia
julia> let nbexports = "$(pwd())/.nbexports", tmpl = "$(pwd())/jupyter_script_export_template.tpl"
for (root, dirs, files) in walkdir(".")
for file in files
if endswith(file, ".ipynb")
outdir = joinpath(nbexports, root)
run(`jupyter nbconvert --to script $root/$file --template=$tmpl --output-dir=$outdir`)
end
end
end
end
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Set up jupyter configuration to automatically export a script file whenever a
Jupyter Notebook file (.ipynb) in the repo is saved. This makes diffing
changes in git significantly easier.
The files are exported to a top-level directory called .nbexports, which
mirrors the filepaths of the real files. (Note, when scripts are renamed
/ deleted, it will require manual cleanup from the .nbexports directory)
Add CONTRIBUTING.md to explain .nbexports and our jupyter config.
Explains that for contributing to this repo, you should start Jupyter
from the top-level of this repo direcotory in order to make sure jupyter
picks up our configuration files.
Manually run the exporter for all our files to seed the repo so that future PRs are more easily reviewed! :)
This PR will be easier to review if you first only look at the changes before running the generation:
https://github.com/JuliaComputing/JuliaBoxTutorials/pull/57/files/2a2f2387fe7a492d0e935991f0f461f51e28ca4d
Then you can look at the final commit by itself: 9dc69c4