0

I have an ipython notebook that I invoke through Django's

shell_plus --notebook 

command.

I would like to save the notebook, meaning the code cells, without saving the output that follows each code cell.

I use this notebook to do analytics and reporting on sensitive patient data covered by HIPAA and so I'd like to be able to persist the notebook in git without exposing the sensitive patient data in the git repository.

David Watson
  • 3,014
  • 2
  • 29
  • 50

1 Answers1

0

Reposting as an answer:

You can set up a git hook that will strip the output from the notebook whenever you commit: gist.github.com/minrk/6176788

A bit more advanced, but less tested, is a tool I wrote called nbexplode, that splits the notebook up into multiple pieces and recombines them. The advantage of this is that you could keep the output in your local copy and only commit the code. But if the simpler approach works for you, I'd go for that.

Thomas K
  • 35,785
  • 7
  • 76
  • 82