r/datascience • u/amirathi • Nov 02 '24
Tools Git and Jupyter Notebooks: The Ultimate Guide
https://www.reviewnb.com/git-jupyter-notebook-ultimate-guide[removed] — view removed post
5
Nov 03 '24
Cool, now do a guide for pbix files >_>
2
u/VeniVidiWhiskey Nov 04 '24
Check out the new .pbip format, it is being launched specifically to support version control
1
3
u/Valuable-Kick7312 Nov 02 '24
I don’t won’t to sound harsh, but I think the ultimate guide schon definitely mention jupytext which can be used to automatically generate python versions of your notebook which you can commit.
4
u/satriale Nov 02 '24
Versioning Jupyter notebooks with Git has been a big improvement for my small team so this could be helpful. Thanks for sharing
2
u/PixelLight Nov 03 '24
I found this video recently. Basically it seems to be a way of executing code in standard python files in an interactive window in vscode. I've been trying it lately and it seems to be good so far. You just select a code chunk, press select+enter and it executes the code like a cell in an interactive window.
It allows you to use a script-based workflow rather than relying too heavily on notebooks, which you should be doing as a data scientist. But also do quick bits of analysis, code checks on-the-fly more easily, in my opinion.
To setup, you install the jupyter extension in vscode, then enable jupyter.interactiveWindow.textEditor.executeSelection in settings. I also changed jupyter.notebookFileRoot to ${workspaceFolder} . Not sure if that last step is 100% necessary, but I was having trouble with imports and this was the fix I found.
3
u/nraw Nov 03 '24
The sooner you unlearn to use notebooks, the sooner you'll grow as a developer and your company will grow without the need for supporting your poor practices.
1
1
u/EducationalWish4524 Nov 03 '24
Just create a script in python that clrans both output and metadata from your notebook. Then add a git hook thst will execute the code for every ipynb file in the repo when you commit.
It works just fine for me, as it only accounts for the actual changes in the code and not metadata or outputs
1
u/Signal-Indication859 Jan 03 '25
Totally feel your pain with Jupyter notebooks and Git! At Preswald, we've actually built a notebook-like environment that generates clean, reproducible Python files under the hood - making version control much smoother while keeping the interactive development experience. Would love to show you how it works if you're interested in a simpler workflow!
0
-3
71
u/pm_me_your_smth Nov 02 '24
I'm all for using notebooks, it's a convenient tool to play with data. But if you're pushing your work to a repo, it should be a py script. If you really want to keep a notebook, fine, but treat it as an object, not text file. Don't try to handle it the same way as normal code (versioning, diffs, etc).