Hacker News new | ask | show | jobs
by eskaytwo 1101 days ago
What’s the current best-practice workflow for using with git? I see jupytext discussed in the comments but this saves the .py exported file. Is there a good clean method for storing tbe .ipynb files into git? It maybe is easier without the cell outputs?
3 comments

I use a pre-commit setup that strips and formats notebooks. IIRC I use a bunch of the nbqa hooks (to also apply black, isort, ruff, etc) but I'd have to check if I moved to different versions for some reason. My workflow uses papermill so the notebooks I store in git are essentially "parameterized templates that get instantiated with data".

https://pre-commit.com/

https://github.com/nbQA-dev/nbQA

https://papermill.readthedocs.io/en/latest/

Jupytext seems the best practice.

The ipynb files are output artifacts. Why would you want to store them into git? It would be like storing compiled program binaries.

In the sense of an evolving notebook that’s used eg like for reports. It would be good to be able to version control this. The output doesn’t need to be saved, but the code itself would be valuable - and then can pull from version control and run.
I had good experiences with nbdime.