r/Python • u/Consistent_Tutor_597 • May 24 '26
Discussion Is jupyter notebooks gonna become text based any time soon?
Hey guys. I used to work a lot with jupyter. But had to move on because .ipynb doesn't go very well in git and ai agents don't really work with them well for similar reasons.
Main culprit is not the notebook itself but .ipynb format. I understand that the notebook world evolved in inline outputs etc. But I think would be cool if .py based notebooks with #%% becomes first class citizen everywhere. There's a tool I used called jupytext which does that but it's bolted on and not native support.
The other tool I have heard about is marimo? I have never used it but it seems like it forces u to not redefine the same variable again. Which is unnatural in python. If python allows u to update a variable, ur notebook should too. But let me know what you guys think. And if there's potential for the data science world to move there anytime soon. I think most people have to explore in notebooks and then convert to py.
84
u/Toby_Wan May 24 '26
I prefer marimo now, and with cells you kind of need to not allow users to refine variables in order to have a consistent state
74
u/HungrySecurity May 24 '26
Actually, .ipynb is a text format. It's essentially just JSON under the hood. But if you're looking for something closer to standard Markdown, you might want to check out RMarkdown or Quarto.
20
u/liimonadaa May 24 '26
I've mostly switched to quarto notebooks
9
u/justneurostuff May 24 '26 edited May 24 '26
I feel like it defeats the point of the format. The cool thing about jupyter notebooks is that outputs are embedded inside the executable source file. There are already many, many existing notebook file formats without this feature that can be adopted with ease. I disagree that jupytext is bolted on; in practice, it’s jupyter notebook support that has had to be bolted onto tools like VSCode and Github, whereas fully text-based formats are already de facto supported because they are fully text-based.
4
u/IAmASquidInSpace May 24 '26 edited May 24 '26
It is kinda strange that, with how popular Markdown has become for documentation,
no one has made anytools that allow using Markdown with fenced code blocks as cells in Jupyter. Seems like a perfect application, but then again, I guess it's not as easy as I am making it sound.Edit: apparently it exists, I just never heard of it.
3
u/j_hermann Pythonista May 24 '26
There is NB-Convert to remove output cells from your Notebooks for Git and also to convert into practically any format you can dream of.
3
u/Feuermurmel May 24 '26
Have you tried this solution? https://stackoverflow.com/a/73218382
It adds a Git filter that'll leave your .ipynb files as is, but will omit the output cells from what is checked into the Git repository. You're left with the text-based JSON notebook files in Git.
2
u/_redmist May 24 '26
Marimo is pretty great.
I will say, the not reusing variables is at times a mild annoyance but nevertheless i would recommend it.
2
u/py_curious May 24 '26 edited May 24 '26
nteract 2 is built specifically to work with agents. You share a notebook with an agent like a pair programmer, or just let the agent build the notebook in a headless session while you tell it what to do and it shows you the results as it builds.
I really like it. I built an agent with Anaconda Agent Studio, added the nteract plug-in and watched the agent as it created new cells, edited existing ones, ran things and chatted with me about what was happening.
https://www.nteract.io/
https://github.com/nteract/nteract
For transparency, my colleagues at Anaconda are contributing to this project so yes, I know them and I want the project to succeed because of that but also because it's genuinely solving some problems with how agents work with notebooks.
edit: spelling and line break to put links on separate lines
2
u/kamilc86 May 25 '26
On marimo, the no redefine rule is what makes the reactive DAG work. Updating a variable reruns dependent cells in dependency order, which is the actual selling point. On git, the real culprit with .ipynb is hidden execution state. Cells can be run out of order, deleted cells leave variables in the kernel, and the file on disk may not match any reproducible path. Practical workflow: jupytext is first class enough. Pair every notebook with a .py mirror using the #%% cell markers, commit only the .py, gitignore the .ipynb, and AI agents read the .py just fine.
3
u/Wh00ster May 24 '26
What are you on about? It is text
4
u/Ok-Management-1760 May 24 '26
Look into jupytext
https://jupytext.readthedocs.io/en/latest/
It will do what you need to do.
1
u/franzperdido May 24 '26
Mystmd is great! It's by the same team!
1
u/123_alex May 24 '26
Use Marino for a bit. You'll get used to not redefine variables and you'll never look back at jupyter.
1
u/EnderAvni May 24 '26
I've actually been working on a VS Code git merge conflict extension if you'd like to try/give it a star! https://github.com/Avni2000/MergeNB
1
u/pplonski May 25 '26
I'm working on notebook based tools for data science, and you are right that ipynb is hard to track by git, but AI agents works very good with ipynb. In one of my tool, I'm using ipynb as a format to store the user conversation with AI data analyst and it is very good format, basically I can store conversation, code cells, and outputs. Then with ipynb ready you can easily convert this to HTML and publish as static web page.
1
u/vanatteveldt May 28 '26
Quarto supports python. I've mostly used it for R, but qmd/Rmd is sooo much better than ipynb in every way...
1
u/spartanOrk May 28 '26
I tried marimo, but I didn't like the way variables had to be defined, and after a recent update some weird dependency creeped in that I couldn't get, at work, so I realized it's not yet ready for production. Too experimental still.
I find myself writing scripts instead. And rerun them. Instead of cells, have functions, to control which parts get executed. Produce X11 graphics. In a way it simplified my work a lot. I don't fight it anymore, I accepted it.
1
u/Kerbart May 28 '26
Use marimo instead. It does exactly what you wish for.
1
u/Gnaxe May 28 '26
https://starboard.gg/ is also text-based. And there's https://clerk.vision/ for Clojure.
1
u/few May 28 '26
You can also clear the cell outputs before checking in to git, then things will be easy. But when there's a binary image embedded, the diff is crazy.
1
u/Choles2rol May 29 '26
Marimo is so much better than Jupyter
1
u/MeroLegend4 May 30 '26
Use marimo
1
u/_r3d3_ Jun 02 '26
nbdime is great for diffing notebook states in a browser.
1
u/amirathi Jun 03 '26
Don't expect Jupyter to budge on the format anytime soon. For the ipynb git diff problem - see nbdime and ReviewNB.
Claude Code now (in 2026) finally works well with Jupyter thanks to the open source Jupyter MCP server.
0
u/GodlikeLettuce May 29 '26
Just use python. A .py
Python rpl is a thing. Im amazed by the amount of people that treat python like its a compiled language
-7
u/AverageComet250 May 24 '26
Gonna be honest, never had a problem with notebooks in git. And 95% of the time you're not actually after version control w/ them, so just add the file and write a nonsense commit msg - you can automate using a hash of the datetime - or use syncthing or a netshare instead.
I have 0 experience using them w/ AI tho. I don't see why the format would be bad other than needing lots of tokens but I'm sure there's a reason for your problems.
0
u/[deleted] May 24 '26
[deleted] — view deleted comment
12
u/[deleted] May 24 '26
[removed] — view removed comment