简体   繁体   中英

How do you manage Jupyter Notebooks in a source code repository?

I created a git repo with some notebook code in it the other week, and I started to wonder how on earth you could exercise change management ( git , etc) on these notebook files, what with the Python source embedded in them.

Then the other day I had to review a co-worker's Notebook code. What a mess! So hard to read diffs, what with cached output and Python code wrapped linewise in JSON.

Is there some way to compose a notebook out of .py files on disk in a relative path or something? Perhaps a different Cell type? Something that will allow me to run interactive notebooks that are running code out of external .py files, so that I can version those files (eg with git ) just like all my other .py files.

If there's some plugin or something you can point me to, please do. If it's just not possible due to the architecture of Jupyter Notebooks, please explain it and help me understand why for myself.

If you've encountered this problem before too, how did you solve it? And if you encountered but didn't solve, please commiserate.

You can use Jupytetxt for easy conversion of notebooks to .py files and back again.

You'd probably be interested in the discussion How to Version Control Jupyter Notebooks . In particular, I know nbdime is popular for comparing changes, see some advice on that in that same thread here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM