News for hackers. Stuff that matters.
Re:JupyterLab 4.0 by eskaytwo on Tuesday June 13, 2023 @10:05PM (#36320483)
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?
Re:JupyterLab 4.0 by enriquto on Wednesday June 14, 2023 @12:01AM (#36321274)
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.
Re:JupyterLab 4.0 by eskaytwo on Wednesday June 14, 2023 @06:59AM (#36324032)
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.
Re:JupyterLab 4.0 by takd on Wednesday June 14, 2023 @07:14AM (#36324134)
I had good experiences with nbdime.
Re:JupyterLab 4.0 by fluidcruft on Wednesday June 14, 2023 @08:29AM (#36324872)
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/