[IPython-User] Strip output from IPython notebook.
Michael McNeil Forbes
Wed Sep 11 21:52:27 CDT 2013
On Sep 11, 2013, at 2:12 AM, Matthias BUSSONNIER <email@example.com> wrote:
> Le 11 sept. 2013 à 09:17, Michael McNeil Forbes a écrit :
>> Over the years there have been lots of discussions about stripping output from IPython notebooks for the purpose of version control. It is really not clear to me that there is a definitive way to do this, so I asked this as a question on stackoverflow.
>> I think that the trail of issues/PRs lead to PR 4175: "nbconvert: Jinjaless exporter base"…
> Yes, jinjaless exporter will help, by giving an API that can be used to **for example**
> to strip output or run a notebook headless.
> Diffing will still be hard. Working on that, but python difflib does some weird stuff :
> Working on difflib 2 before going further with that.
> What you are looking for are git clean and smudged filter that apply a transformation
> when staging (clean) and checking (smudge) files to/from the index. it does not require
> jinjaless exporters, you just have to walk json by yourself. it will just be eased by #4175.
> Bind strip output to (stage/clean), rerun headless to (checkout/smudged) and you get what you ask,
> ie a repo without output, but CWD with ipynb files with output.
Any idea how to do a similar thing with hg? It seems like this type of thing might be a clear
advantage for git's staging area, but I have not played enough with git to be sure.
> I personally would like a ipynb backend where ipynb are full git repo.
> eg, each cell/output a file + an index file that tells how to "rebuild" the ipynb from this folder.
> It might or might not make sense to you.
For my purposes, having input and output in separate files would be the ideal solution, but
I understand why this is not desirable from the perspective of sharing work, nbviewer etc.
> In any case I don't think there would be a final solution that came from IPython itself.
> We provide tools, but the more is external to IPython the better. Seeing the huge amount
> of transformation that people wan tho do on notebook at save time we cannot offer options
> for all, so at some point we will have a post save/pre-load hook. Or you can already
> write your own backend to save files. It will be eased by nbconvert, but it will most probably
> not be built-in.
I appreciate this: maybe the simplest solution for me would be a hook that saved both a full
and a clean copy on save, so that I could choose which one to keep in my VC.
In any case, once the tools are in place, there should be some definite examples/documentation
telling users how to clearly proceed with setting up a solution… I must admit, as a user,
"Jinjaless exporter base" is not what I would look for to find the current
state of affairs regarding this issue:-)
More information about the IPython-User