Skip to content

Make git reviews easier: Set up auto-exporting scripts from notebook files on save#57

Merged
NHDaly merged 3 commits intomasterfrom
nhd--auto-export-scripts
Jan 3, 2020
Merged

Make git reviews easier: Set up auto-exporting scripts from notebook files on save#57
NHDaly merged 3 commits intomasterfrom
nhd--auto-export-scripts

Conversation

@NHDaly
Copy link
Copy Markdown
Contributor

@NHDaly NHDaly commented Jan 3, 2020

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

NHDaly added 3 commits January 3, 2020 13:26
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
```
@NHDaly NHDaly merged commit 0da52fb into master Jan 3, 2020
@NHDaly NHDaly deleted the nhd--auto-export-scripts branch January 3, 2020 18:50
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

Successfully merging this pull request may close these issues.

1 participant