Follow

What is the best way to use Jupyter notebooks and Github? The diffs in the comments are barely readable, and I recall being some wah to handle it properly. Could somebody help me here?

@mpm The best approach is to clear all output cells before committing. Of course, this can be tedious to remember every time, so there are bash scripts you can install within your directory to run automatically for you, e.g. gist.github.com/ageron/c9ad56e

I also really like Google Colab for collaborating on notebooks! Then slowly move functions into a module that is git-committed and imported, as things start to shore up.

@mpm There is reviewnb.com for github reviews of jupyter notebooks and github.com/jupyter/nbdime for terminal diffs. but also, my two cents: keep notebooks to the very bare minimum (tutorials, interactive viz) and put the rest of your code in proper Python modules that you import from the notebook.

@moremeta that looks perfect for what I need, thanks!

@seve_py that one is interesting too. I'll give it a try. Thanks!

@mpm One solution is to use nbdev fast.ai/posts/2022-08-25-jupyt but if that's too much of a commitment, the diff problem is handled well by reviewnb.com/

@lobrien thanks! I've been using your suggestions and that works fine for me.

@mpm also recommended - jupytext for syncing a notebook with a .py or .md : github.com/mwouts/jupytext Works both directions.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.