Have you ever spent an afternoon wrestling with a Jupyter notebook, hoping that you ran all the cells in just the right order, only to realize your outputs were completely out of sync?
Today's guest has a fresh take on solving that exact problem.
Akshay Agrawal is here to introduce Marimo, a reactive Python notebook that ensures your code and outputs always stay in lockstep.
And that's just the start.
We'll also dig into Axie's background at Google Brain and Stanford, what it's like to work on cutting-edge AI, and how Marimo is uniting the best of data science exploration and real software engineering.
This is Talk Python to Me, episode 501, recorded Thursday, February 27th, 2025.
Are
you ready for your host, please?
You're listening to Michael Kennedy on Talk Python to Me.
Live from Portland, Oregon, and this segment was made with Python.
Welcome to Talk Python to Me, a weekly podcast on Python.
This is your host, Michael Kennedy.
Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython, both accounts over at fosstodon.org, and keep up with the show and listen to over nine years of episodes at talkpython.fm.
If you want to be part of our live episodes, you can find the live streams over on YouTube.
subscribe to our YouTube channel over at talkpython.fm/youtube and get notified about upcoming shows.
This episode is sponsored by Worth Recruiting.
Worth Recruiting specializes in placing senior level Python developers and data scientists.
Let Worth help you find your next Python opportunity at talkpython.fm/Worth.
Akshay, welcome to Talk Python to Me. Awesome to have you here.
Thanks, Michael. Really happy to be here.
Yeah, it's data science hour, isn't it?
Yeah, I guess it is.
In a sense, but also in a sense, kind of bringing data science a little closer to traditional, formal computer science or more.
I don't know.
I don't know what to think about computer science.
Software engineering.
Yeah, that's our goal.
Blending data science with sort of the rigor reproducibility of software engineering.
Yeah.
And I think people are going to find it pretty interesting.
It's definitely gained a lot of traction lately.
So it's going to be really fun to dive into Marimo.
Before we do, though, who are you?
What are you doing here? Tell people about yourself.
Sure. So I'm Akshay. I'm one of the co-founders and developers of Marimo.
I started working on Marimo a few years ago, I guess, a little over two years ago, right after I finished a PhD at Stanford where I was working on machine learning research.
And before that, I was at Google Brain where I worked on TensorFlow.
And I guess for the past several years, I've been wearing different hats, It's either a computer systems hat where I build open source software and domain specific languages for people who do machine learning or I just do machine learning.
And for the
past few years,
it's been the first hat.
So working on the Marimo notebook, which is our attempt to blend the best parts of interactive computing with the reusability and reproducibility of regular Python software.
Well, that's very cool.
You've been right at the cutting edge of this whole machine learning thing, I guess, right?
If you go back a handful of years, it's different today than it was five years ago.
Oh, yeah.
It's very different.
I was at Google Brain 2017 to 2018.
So I think we had Transformers, but we didn't really appreciate all that they could do.
Yeah.
But it was a really exciting time to be at Google Brain where it was pure research, just like one, that you could just work on anything that you wanted to work on.
And I was an engineer there on a, actually on a small sub team inside of TensorFlow where we were working on TensorFlow too, which is sort of making TensorFlow more like PyTorch crudely.
And that was a lot of fun, but yeah, got to go to like a bunch of talks by researchers and it was a special time for sure.
Yeah, I bet it was.
Well, you know, that's such an interesting background.
I think maybe give people a sense of what is Google Brain and all that and maybe just Transformers, right?
It's the foundation of so much surprising and unexpected tech these days.
Yeah, yeah, I'm happy to.
So Google Brain, what is Google Brain?
So I guess technically Google Brain no longer exists as it did back then.
Now it's just DeepMind with DeepMind and Google Brain merged.
But back then Google Brain was, so there was, I guess, two researchers under the alphabet umbrella, Google Brain and DeepMind.
And Google Brain was a place where it was really special.
So there were folks working on all kinds of research projects from you, like using transformers for code generation, but also like systems research projects.
Like I was there when
the JAX
machine learning library, which is an alternative to TensorFlow and PyTorch, was still being in the early days of development.
And I was able to meet with like Roy Frostig, Matt Johnson.
And that was really cool sort of coming up to speed on machine learning systems in that era.
I was only there for a year because I decided I wanted to go back and do a PhD myself in machine learning research where I used actually TensorFlow and PyTorch to work on new sort of like machine learning modules.
Did you feel bad when you used PyTorch?
You're like, oh, I'm cheating.
No, no.
I mean, a little, I guess.
But, you know, it's the thing like everyone else used PyTorch.
And we had just started working
on TensorFlow
too when I joined, whereas PyTorch had already been mature.
So it was the responsible thing to do.
And
Transformers,
what are these Transformer things?
They came out of Google, right?
Yeah, yeah, they did.
Attention is all you need.
These Transformer things, I guess, are the backbone of all these large language models that we're seeing today.
And they proved to have like an incredible capacity for modeling, I guess, in a generative way, all kinds of text.
And in a way that, honestly, if I had to admit, surprised me.
At the time in 27 to 18, we were doing good work in machine translation and stuff.
But even back then, there was researchers who were working on, at Google Brain, code generation, writing a bunch of unit tests, stuff that people do regularly today, actually, with large language models.
I put on my systems engineer hat back then, and I was a little skeptical, to be honest.
And I've just totally proved wrong, and I'm happy to have been proved wrong.
So it's been phenomenal seeing sort of that, the success of that particular model.
And yeah, having
quite a small
part in it.
Yeah, I was, I've been a long time skeptic of machine learning in the sense that for so long, it was, it's kind of like fusion.
It's going to be amazing, but it's 10, 20, 30 years out and maybe, you know, and it was all almost like knowledge, knowledge-based type things.
And just,
I
mean, it was interesting.
it looked kind of relevant and possibly useful in some of the cases, but not like it is today.
Like today, people who don't even care about technology are blown away by this stuff, and they use it all day long, and it's gone so much farther and so much faster than I expected it to.
I'm all about it these days.
I still write most of my code, but any time there's something tricky instead of going to Google and hunting through Stack Overflow, let's see what chat says about it or something like that.
And then maybe we'll go to Google if we don't get a good answer, you
know?
Yeah.
No, no, I'm the same way.
I spent more time than I care to admit last night migrating from Vim to NeoVim.
And I know I'm late to the party, but perplexity and other tools just made it a lot easier to start from scratch installation without bringing over my VimRC.
And you
can ask it detailed questions, right?
For example, I
needed some way to reset the initial offset in DaVinci Resolve timelines.
It was, okay, well, here's your four options, and these are the way you can do it, and these are the tradeoffs.
It's not just you might get an, you know, here is the switch, but you get an analysis.
And I'm pretty impressive.
So the reason I'm going into this is I want to ask you, having been on the inside at the early days, what is your perspective of seeing this trajectory or trajectory is the way I should point it.
Upwards, not logarithmic.
Yeah.
I guess what I will say is I think one thing that's like really changed, like, so back when I was at Brain, even the models were advanced, like, I felt like in order to use machine learning well, you really did need to be somewhat trained in machine learning.
You know, it was important to understand what a loss function, like basic things, like what a
loss function was,
what's training, what's validation.
These days, like, you don't need to, like, at all, actually.
I think especially to use LLMs, right?
Like, you just need to know inputs and outputs.
It's like a function call that sort of has fuzzy outputs.
You know,
it's a mathematical
function in quotes.
Yeah.
So
I think that's one thing that's totally...
I guess it kind of shows that artificial intelligence is transitioning more from, I guess, like a science to a technology, and that tool that people can just readily use without
really needing
to understand how it works.
As for the trajectory, I've been bad at making predictions in the past.
I think I will be bad at predicting anything right now.
Surely, these models are very good for coding.
for massaging marketing copy and like you know i do like the random tasks where like i have a bio i wrote in for first person and someone asked for it in third person and i'm too lazy to change and i just give it to a chat model um yeah but if you ask for a trajectory of agi or asi which i don't even remember what the s stands for these days but i i'm not sure i can predict anything on those timelines.
Yeah. I hear you. I'm, I'm, I'm with you on the projects prediction, but I would say that the adoption and effectiveness of it has far outpaced what I would have guessed five years ago.
Yeah. I mean, even local models, like it's kind of exciting, like what you can just run on your Mac book.
I also
didn't really anticipate that. yeah.
All right. I don't want to make this the AI show cause it's not about
AI,
but your background is so interesting. So when you were working initially on transformers did you perceive you as a group not you individually you guys perceive the need for the scale of the computation like you know to train gpt01 i don't know how much compute was involved but probably more than cities use in terms of energy sometimes you know what i mean it was a lot and how much compute were you all using back then versus now i guess is what i'm getting that so
i guess yeah and i think you kind of said it but just just to clarify or to make it clear that i personally didn't work on transformers i was working on tensorflow so that yeah
the yeah the
i guess embedded dsl for for training machine learning models that was used within google and still used today um i can't give you specific numbers to be honest because i was pretty deep in the systems part of working on tensorflow and not paying too much attention for like standing up distributed clusters.
I did things like adding support to TensorFlow for creating a function library.
TensorFlow is like a Dataflow graph engine, and it didn't have functions, so I added support for functions, partitioning functions over devices, but other teams used that work to go and train the big models.
I know it was a lot of compute, but a lot versus a lot, all
caps versus just capital case.
Yeah,
I'm sure
there's a delta.
I just, I don't know how much.
Yeah.
Well, today they're all talking about restarting nuclear reactors and plugging them straight to the data center.
So it's a weird time.
Let's go back.
Maybe a little bit before then, 2012 or so, I believe is maybe the right timeframe.
And let's talk about notebooks.
And, you know, around then, Jupyter notebooks burst on the scene.
And I think they fundamentally changed the ecosystem of Python and basically scientific work in general, right?
By changing Python, I mean, there are so many people in Python who are here because they got pulled into a notebook.
They wrote a little bit of code.
They got incredible results.
They were never, ever a programmer, but now they're the maintainer of an open source project or something like that.
You know what I mean?
They're just like, oh, this is kind of neat.
oh I'll create a biology library or whatever and then all the all of a sudden you know they're they're deep in it and so jupiter I think was really the start of that maybe there was some precursors that I'm not familiar with
yeah jupiter was essentially the start of it especially for python like I think
the idea of computational
yeah notebooks has been around but uh yeah the ipython repl I guess the ipython project with the ipython repl I think was early 2000s and um And Jupyter, I think you're right, like 2012-ish, as he's burst onto the scene with putting the IPython REPL into a web browser with multiple REPL cells, and all of a sudden you could do more than what you could do in the console and also made it a lot more accessible.
Yeah.
Going back to that sixth cell you entered on your REPL and editing it, that is not a way to draw beginners in.
No, definitely not.
Up arrow key six times, no.
Yeah, 2012, coincidentally, is when I started college as an undergrad.
So I had been using, I kind of grew up, as long as I used Python, I think I probably was using Jupyter Notebooks.
And I even started using Google CoLab before it was made public, because when I was interning at Google, and I think the year I started working at Google full-time is when they made it public to the world.
So, yeah, notebooks have sort of shaped the way that I think and interact with code quite a bit.
Yeah, absolutely.
So maybe you could give us some perspective.
It sounds like you were there, like, right at the right time.
You know, what was the goal and sort of the job of Jupyter Notebooks and those kinds of things then?
And how has that changed now?
And maybe how does it still solve that problem or not solve it so much?
Yeah, I think, so stepping back.
So you mentioned like how many people who might not have traditionally, you know, worked with code sort of came into it because of Jupyter Notebooks.
And I think that's like really, I think you're onto something there.
I think that's correct.
And I think the special thing about Notebooks is that they like mix code and visuals and like narrative text in like this interactive programming environment.
And that interactivity in particular, I think is really important for anyone who works with data.
It's where you got to like first like, you know, run some queries against your data to see the general shape of it, you know, run some transformations to see like, you know, basically like explore your data, like hold it in your hands.
Right. And like, you know, REPLs before and then Jupyter Notebooks in particular lets you do that in a way that you just can't easily do in a script because it holds the variables in memory.
And so I think the role that it played was that it enabled data scientists or computational scientists, biologists, astrophysicists, all these different types of people who work with data.
It let them rapidly experiment with code and models and importantly, get some kind of like artifact out of it.
And in particular, this was like a static HTML type artifact, right, where you have some text documenting what experiments you're running.
you have Python code, and then you have like Matplotlib plots and other artifacts.
And I think for the sciences in particular early on, that was super important and transformative.
And we were talking about other computational notebook environments.
And it's interesting to mention this because things like this existed sort of before, like Mathematica's workbooks, I think they
called them.
I might have
done that wrong.
But I think just like the open source nature of Python and the accessibility of it just like made it way easier to get started.
And also the fact that it was like browser based, right, so that like you can easily share like these, the HTML artifacts that come out, I think was really transformative.
And insofar as like what they're used for today, they're used for a lot.
It's kind of remarkable how much they're used.
Like I remember seeing a statistic for Google CoLab alone, which is just one particular hosted version of a Jupyter notebook.
And it was two years ago, and they said something about like having 10 million monthly active users.
And so the number of people who use Jupyter on a monthly basis is surely larger than that.
Oh, yeah.
And they're used for the sciences, but they're also used for like things where you want, like the traditional rigor and reproducibility of software engineering.
So they're increasingly used for like data pipelines and like ETL jobs.
And like, so anyone who's in Databricks, for example, runs like, they call them workflows, Databricks workflows, through essentially Jupyter Notebooks.
They're used for training machine learning models.
Like I've trained many models in a Jupyter Notebook.
I've developed algorithms in Jupyter Notebooks.
I've produced scientific figures that go straight into my paper from a Jupyter notebook.
And the reason people do this is because, again, the interactivity and the visuals that come out is very liberating compared to using a script.
I think there's also a developing understanding that happens from them.
Because when you're writing just a straight program, you're like, okay, this step, this step, this step, this step, and then we get the answer.
Whereas notebooks, it's like step one, step two.
Let me look at it.
oh, maybe that's different.
Let me go back and change.
It's more iterative from an exploratory perspective.
Yeah, I think that's exactly right.
Because you have that, when you're writing a software system, you kind of know the state of the system.
You know what you want to change it to.
But when you're working with data, there's that unknown, what will my algorithm do to my data?
You
just have
to run
it to find out.
Yeah, absolutely.
And graphs and tables and iterative stuff like that is really nice.
So why create something instead of Jupyter?
Why is Jupyter not enough for the world?
Yeah.
I think there's a...
So just, you know, you're the creator of Marimo, along with the rest of the team and so on.
But yeah, it's like, why create this thing when Jupyter exists?
Yeah.
So I think there's quite a few reasons.
So Jupyter notebooks are like, I guess, It's more like Jupyter Notebooks powered by the IPython kernel, just to put a finger on it.
Right, because it could be different.
It could be like a C++ kernel or.NET kernel or whatever.
Yeah, exactly.
But this particular form of notebooks where you get a page and then in the front end shows you a bunch of cells that you execute one at a time imperatively, even though you have a sequence of cells, it still is essentially a REPL.
And like it's the onus falls on the developer, the scientist, whoever's using it to like run each cell on their own and like maintain the state of their kernel.
So like you run a cell, say you have three cells, you know, you decide to go rerun the second cell.
You have to remember to rerun whatever cell depends on it.
Maybe it's the third cell.
Maybe it's the first cell because you wrote things out of order.
And so you can easily get into a state with Jupyter Notebooks where your code on the page doesn't match the outputs that were
created.
Yeah. So if you were to like basically go to the menu option, say rerun all cells, you would get different answers.
Exactly. And this is like it's actually been studied and like it happens a kind of a shockingly large amount of times that like.
So there's one study in 2019 by Pimentel, I'm going to probably pronounce his name wrong, but by I think four professors.
And they studied a bunch of notebooks on GitHub.
And they found that only like a quarter of the notebooks that were on GitHub, they were able to run it all.
And then like either 4% of those or 4% of all of them, only 4% of them like when they ran recreated the same results that were serialized in the notebook.
Meaning like maybe people ran sales out of order when they originally created the notebook and then committed it.
Or maybe they didn't like create a requirements.txt that faithfully captured the package environment they used.
So there's like this recognition that Jupyter Notebooks suffer from a reproducibility crisis, which is rather unfortunate for a tool that is used for science and data science and data engineering, like things where reproducibility is paramount.
And so that was one issue.
Reproducibility was like one main thing that sort of we wanted to solve for with Marima notebooks.
And the other thing I think that we alluded to earlier is that Jupyter notebooks are stored as like a JSON file where like the outputs, like the plots, et cetera, are serialized as these binary strings.
And like the, you know, the one downside of that is that you can't really use these things like you can use like traditional software, at least not without jumping through extra hoops.
So like you make a small change to your Jupyter notebook, you get a gigantic git diff because, you know, the binary representation of some object changed by a large amount.
You want to reuse the Python code in that Jupyter notebook when you have to run it through like a Jupytext or some other thing to strip it out.
And then so you oftentimes you get this like situation where people just like end up copy pasting a bunch of things across a bunch of notebooks and it quickly gets really messy.
And that was another thing we wanted to solve for, making notebooks like Git-friendly and interoperable with other Python tooling like Git, pytest, etc.
Yeah, there's some things that will run them kind of function module-like, but yeah, it's not really the intended use case, is it?
Yeah, it's not, but people want to, which is, I think, like the, it's funny because like the intended use case, I think, of like traditional notebooks like Jupyter was like interactive REPL, explore data, produce like simple narrative text.
But then like they just got used for so much more than that in situations where reproducibility, reusability is like really important.
And I think that that's what we're trying to solve for.
This portion of Talk Python to Me is brought to you by Worth Recruiting.
Are you tired of applying for jobs and never hearing back?
Have you been getting the runaround or having trouble making it past the AI resume screeners that act as the new gatekeepers for your next level Python job?
You should reach out to Worth Recruiting.
Worth Recruiting specializes in placing senior level Python developers and data scientists.
They work directly with hiring managers at startups, helping them grow their software engineering and data science teams.
with Worth it's not just connecting you with the company it will guide you through the interview process and help make sure you're ready with their detailed preparation approach they can even coach you on salary negotiations and other important decision making processes so if you're ready to see what new opportunities are out there for you reach out to Worth Recruiting let them be your partner and specialist to find the right Python developer or data scientist position for you fill out their short contact form at talkpython.fm/worth. It only takes a minute. That's talkpython.fm/worth.
The link is in your podcast player's show notes. Thank you to Worth Recruiting for supporting the show. I was just wondering out loud, you know, that study. I know it was not your study, so I'm not asking you for answers. Just, just what do you think? If it's that low of a percentage of reproducibility because people fell down on their like rigorous software engineering, for example, like no requirements file or hard-coded pass instead of relative pass or whatever.
If it's that number for notebooks, I wonder about just plain Python files that are also meant to act to solve like science problems and stuff that just didn't happen to be in notebooks.
I wonder if they're any better.
Yeah,
it's a good question.
I think they will be better.
I can just give an anecdote to why I think they would be better.
And so one example, and this happened to me many times, But like one particular example is like when I was working on my PhD thesis, which was about vector embeddings, it was me and a couple of co-authors.
And, you know, both of us did our, like created the examples for this embedding algorithm in like Jupyter Notebooks.
And these notebooks produced a bunch of plots, et cetera.
And so at the end of the, once the thesis was written, I was putting up all our code on GitHub.
And so I asked one of my co-authors, like, hey, like, can you share your notebooks with me?
And this co-author is amazing.
He's really smart, but not necessarily trained as a software engineer.
And he shares his Jupyter notebook with me.
And I run it.
It doesn't work at all.
And the reason it doesn't work at all is that there's like multiple cells.
And there's like this branching path where like it's clear that like he ran like, you know, you see the execution order serialized in the notebook.
And it's not like
one,
two, three, four.
It's like one, two, seven, four.
It's like
these cells were
ran in this path dependent way.
And then also it's like there's like three cells in the middle.
He ran just one of them.
I'm not exactly sure which one.
And like, whereas if you had a Python script, there's only one way to, I mean, sure, you can have
data files.
That's a good point.
You do not really get a choice.
It runs
top to bottom.
Exactly.
Depending
on the data.
Okay.
So yeah,
that is something that's really, it's just very counter to the concept of reproducibility is that you
can
run them in any order and there's not, you know, I feel like Jupyter Notebooks should almost have like a red bar to the cross, like an out of order bar.
warning across the top if it's not top to bottom.
It doesn't have to be 1, 2, 3.
It could be 1, 5, 6, 9.
But it should be a monotonic increase in function as you
do the numbers top
to bottom.
Otherwise, it should be like a big warning or like a weird, like some kind of indicator, like, hey, you're in the danger zone.
You know what I mean?
Yeah, and there's actually another thing that actually has happened to me way more often than I should care to admit while working with Jupyter Notebooks is that it's not just the order.
you run the cells it's also like what happens if you delete a cell because when you delete a cell you no longer so say a cell declares a variable x and you deleted that cell you're like i don't want x anymore but you may forget that just by deleting the cell um you're not removing the variables from memory and so like x still exists and so then you're running other cells that depend on x everything's fine uh but then you come back and you run your notebook and everything's broken and you don't You have no idea.
The first time this happened to me, it took me forever to debug.
I
can imagine
that is so rough.
Yeah.
Later on, you realize, okay, this is a pattern that happens.
But it's like, yeah, so that's another thing that we also wanted to solve for in Marimo notebooks.
Awesome.
All right.
Well, tell us about Marimo.
Okay.
So let's see.
So Marimo is, it's an open source notebook for Python.
The main thing that's different between Marimo and Jupyter is that Marimo is reactive.
And what that means is that unlike a Jupyter notebook where you can run cells in any arbitrary order you like, in Marimo, when you run one cell, it knows what other cells need to be run in order to make sure that your code and outputs are synchronized.
So it's kind of like Excel, right?
So you have two cells.
One declares X.
Another one references X.
you run the cell that declares X or defines X, all other cells that reference X will automatically run or they'll be marked as stale.
You can configure it if you're scared of automatic execution.
But the point is that it manages your variables for you so
that you
don't have to worry about outputs becoming decohered from your code.
And similarly, if you delete a cell, the variable will be scrubbed from memory and then cells that are dependent on it will either be marked as stale a big warning or automatically run and invalidate it.
So that reactivity provides some amount of reproducibility.
And then it also, some of the key features, and then we can dive into each of them, is an additional reactivity.
Marima notebooks are stored as pure Python files, which makes them easy to version with Git.
And then we've also made it easy to run Marima notebooks as Python scripts and then share them as interactive web apps with little UI elements.
Yeah, I'm excited to talk about that.
Some cool stuff there.
Okay, so when you create a variable, if you say like x equals one, it's not just a pi long pointer in memory, right?
It's something that kind of looks at the read and write that get in the set of it and creates like a relationship where it says if you were to push a change into it, it says, okay, I have been changed.
Who else is interested in reading from me?
And it can sort of work that out, right?
How does that work?
Actually,
it's not really implemented in that way.
Okay.
So, okay.
So let's see.
Yeah, this is interesting to dive into because there's like two ways that you can like get at reactivity.
Like so in Marima, what we actually do is we do static analysis.
So we
look for
definitions and references on like of global variables.
And then so we just make a graph out of that.
So for every cell, we look at the, I guess, the loads in the ASTs and then like
the assignments.
And so we can see statically who declares what and who reads what, but who is a cell.
And so that makes it like performant and also predictable of like how your notebook is going to run.
A alternative, I think what you were getting at was like runtime tracing.
More like a JavaScript front end sort of deal, like a view binding model binding type thing or something like that.
Yeah. So yeah, we, everything we do is static, is done with static analysis.
this there was another project called ipyflow which was like a reactive kernel for jupiter it's still around um they took like the runtime tracing approach of like checking on every assignment like okay
okay
there's a read and now where is that where is that object in memory and then running cells that depend on it um i think in practice you know i was talking to steven mackie the author of that article of that extension and then also like based on some work that i saw at Google TensorFlow, that's really hard to get 100% right.
It's basically impossible to get 100% right.
So you will miss some low references and definitions.
And so there's this weird usability cliff as a user where when you run a cell, you're not sure what else will run.
Whereas if you do it based on static analysis, you can give guarantees on what will run and what won't.
Yeah, I guess the static analysis is a good choice because there's only so many cells.
You don't have to track it down to like, well, within the DOM and all the JavaScript objects, we're linking all these together and they can do whatever they want from all these different angles.
It's just like, when this cell runs, what other cells do we need to think about?
So it's kind of like, what does this create?
What does it change?
And then push that along, right?
So it's a little more constrained.
Exactly, yeah.
So basically, yeah, that's exactly right.
And so it's a data flow graph where the data flowing on the edges is the variables across cells.
Yeah, I don't know.
I think I've been thinking about Dataflow Grass for a long time, ever since TensorFlow, doing my PhD too when I worked on CVXPY.
So it's just a thing that I enjoy thinking about and working on.
Yeah, well, what about your experience working on TensorFlow and at Google and at Stanford and stuff that sort of influenced this project?
Yeah, a couple of things.
So definitely a big thing that influenced this project was working as a scientist at Stanford where like I and my colleagues use Jupyter Notebooks like on almost a daily basis because they want to see our data while we worked on it.
And so really valued the iterative programming environment, really didn't like all the bugs that we kept on running into, which are
like kind of our
fault, right?
Because of like, oh, we forget to run a cell, et cetera.
Didn't like that it was not easy to reuse the code in a notebook in just other Python modules.
Didn't like that I couldn't share my artifacts in a meaningful way with my PhD advisor who can't run Python notebooks.
I couldn't make a little app to showcase my
research project.
It's so interesting how PhD advisors and just professors in general, how they're either embracing or their inability to embrace or their prejudices for or against the technology so influence science, the people in the research teams, everything.
It's like, well, we'd like to use this, but the principal author really doesn't like it, doesn't want to run it, so we're not using that.
Or, you
know, just
these little edge cases.
Like, I was made to learn Fortran in college.
I'm still sour about it.
That's funny.
Yeah, no, it's true.
Yeah, it does have a big effect.
And then at Google, I guess the things that influenced – so we used Notebooks 2 there.
Since I was doing the systems engineering work at Google, I personally didn't use them too much, although I did use like Google Colab for like training, like creating training courses and stuff for, for like other engineers and for demos.
But I guess the part of Google that influenced it was just like thinking about data flow graphs for a
year. And you
know, I, we were, there was like a couple of parable projects, like one that was using runtime tracing for like figuring out like how to make a DAG. And it was just, I don't know, kind of traumatic just because you like you miss things and the user experience is just like it kind of falls over.
And so I guess the part from there just made me not want to use runtime
tracing,
made me embrace static analysis for this.
Yeah.
Yeah, it makes a lot of sense.
All right.
Well, let's talk some features here.
What are the, I guess probably the premier feature is the reactivity, in which case it doesn't matter which cell you run, they're never going to get out of date, right?
Yeah, that's correct.
So the reactivity, in other words, the data flow graph behind it is the premier feature.
And it lets you reason about your code locally, right, which is really nice.
Like you can just look at your one cell.
You don't really have to worry about, you know, you know what variables it reads and what it defines.
And you don't have to worry about, oh, but what cells do I need to run before this?
So not only does it like make sure your code and outputs are in sync, it also like makes it really like fun and useful.
to really rapidly experiment with ideas.
As long as your cells aren't too expensive, if you enable automatic execution, you can change a parameter, run a particular cell, and it'll run only what's required to update subsequent outputs.
And then another consequence of reactivity that I think is really neat and our users really like is it makes it far easier to use interactive UI widgets than it is in like a Jupyter notebook.
And the way that this works is that, so Marimo is like both a notebook and also a library.
So you can import Marimo as Mo into your notebook.
And when you do this, you get access to a bunch of things, including a bunch of different UI widgets, ranging from the simple ones like sliders, drop-down menus, to like cooler ones like interactive selectable charts and data frame transformers that automatically generate the Python code needed for your transformation.
And the way that reactivity comes into here is that because we know when you create a UI element, as long as you bind it to a global variable, just say my slider equals mo.ui.slider, then when you interact with the slider anywhere on the screen, well, we can just say, okay, that slider is bound to X.
We just need to run all other cells that depend on X.
all of a sudden you have really nice interactivity, interactive elements controlling your code execution without ever having to write a callback.
And so I think people find that really liberating too.
So you don't really have to hit backspace, change
a
character value for your variable, shift, enter, shift, enter, shift, enter.
Just change a number and everything automatically recalculates.
Yeah.
In this dependency flow, is it possible to have a cyclical graph?
Like if I did this in Jupyter, I could go down to the third cell and define X and then go back up and then use X.
If I run it in the right order, it won't know that there's a problem.
Imagine it's only possible to go one way, right?
You can't get into a weird cycle.
Yeah.
So we do give people escape patches.
We ask them, please don't use it unless you really know what you're doing and you really want to do this.
Because in most cases we find, especially for like if your goal is to just like work with data data scientist, data engineer scientist. We feel you don't need that cycles. You don't need cycles.
But if you're making an app, and I guess I should mention Marimo lets you run any notebook as well a notebook, but also from the command line, you can serve your notebook as a web app, like similar to Streamlit if you've seen that. In those cases, sometimes you do want state basically, right? Like cyclic references. So by default, Marimo actually checks for cycles. If you have a cycle across cells, politely tells you, hey, that's not really cool in Marimo.
Please break your cycle.
Here's some suggestions how to do that.
But if you're really insistent, then you can go to our docs and learn about the state object that we have that does let you get into some runtime-based cell execution.
You can update a state object and kind of in a React from 10D way, it'll run dependence of that state.
Okay, interesting.
Yeah, I guess that makes sense for apps.
You definitely need some sort of global state there.
Yeah, I
think we've seen that sometimes our users will reach for state in call VIX just because that's what they're used to.
And that's what they maybe were required to use in Jupyter, et cetera.
So we're trying to tell them, hey, in most cases, you actually don't need this.
Yeah, very cool.
So when you create a Jupyter notebook, you don't really create Python files.
you create the notebook files, and those notebook files are JSON with both embedded cell execution bits, the code, but also the answers that go below.
That's why if you go to GitHub and you look at a notebook, you can instantly see what could be super expensive computation, but pictures and stuff there because it's residual in the artifact, right?
Yeah.
If you guys do Python
files, do you have a way to save that state in a sort of presentation style or something like that?
You know what I mean?
Is there like an associated state file?
Yeah,
so that's a really good question.
And the answer is yes, but that is the biggest trade-off, I think, of our file format.
So like a surprising number of people actually have come to us and told us, I didn't expect this, but they tell us the reason we decided to try Marima Notebooks is because you say it is versionable with Git.
Like that's like, they're like, that's the one reason I, especially like people in software and industry.
And then they stay for all the other things.
So that's what the pure Python file format allows, in addition to modularity, running it as a script.
For seeing outputs, yeah, they're not saved in the Python file.
So we have a couple of ways to get around that.
So one, you can export any Marimo notebook to an IPython notebook file, actually.
So you
can set up this, we have a feature, automatic snapshotting.
You can automatically snapshot your notebook to like a parallel IPIMB file that's stored in a subdirectory of your notebook folder.
And so you can push that up or share that if you like.
When working locally, though, we actually have this cool feature that my co-finder Miles recently built is that we actually – so when you're working, you're working with your notebook, the outputs are actually saved.
The representation of the outputs are saved in this subdirectory, underscore underscore marimo.
So that the next time you open the notebook, it just picks up those outputs and then like loads them into the browser so that you can see where you left off.
So
I see. So kind of like PyCache.
Yeah.
I would actually assume given the name, but I haven't actually looked into PyCache too much.
Well, I mean, just in the sense that it's saved like right there in your project using that directory.
Oh, yes, yes. You have a PyCache folder. Exactly.
Yeah,
yeah, yeah. Exactly.
And we have one
other feature that another contributor, his name is Dylan, has been developing, which I think is really cool, which is along those same lines, but based on Nick's style caching.
So it'll actually save the Python objects themselves using a variety of different protocols.
And because we have the DAG, he can actually guarantee consistency of the cache.
But that
means not only are your outputs
automatically loaded, also the variables are loaded, so you can literally pick up where you left off.
Yeah, it sounds like some sweet SQLite could be in action there instead of just flat files or whatever.
Yeah.
Yeah, very cool.
So you talked about when the reactivity fires, it can sometimes be expensive to recompute the cells.
Sometimes they're super simple.
Sometimes they're trained in the machine learning model for two days.
Yeah.
Are there caching mechanisms?
You know, in a Python script, we've got functools.lrucache, and then there's other things that are kind of cool, in-process caches, like PyMocha is kind of like the functool stuff, but way more flexible and so on.
And you could put those onto functions that then would have really interesting caching characteristics, like, hey, if you're going to rerun it, but I've run it before with this other value, here's the same answer back, right?
Is there a way to set up that kind of caching or performance memoization type stuff?
Yeah, definitely.
And that same contributor, Dylan.
So he's implemented these and is continuing to build it out.
But we have, I guess, two options.
One is in-memory cache, which is basically the API is the same as functools.cache, but is designed to work in an iterative programming environment.
If you use functools.cache naively, if a cell defining a function reruns, your cache gets busted.
So modoc.cache is a little smarter, and using the DAG can know whether or not it needs to bust the cache.
But to the user, it feels the same.
And then we also have a persistent cache, which is the one that I was alluding to when I mentioned you can automatically pick up where you left off by loading objects from disk.
And so you can put an entire cell in a context manager with MoDub persistent cache.
It'll sort of do the right thing.
We've been talking about experimenting with letting users opt into global cell-wide caching, just automatically memorize cells or just have a UI element
to do something like that.
But we haven't quite done that yet.
Yeah, I mean, it sounds real tricky for Jupyter.
But because you all know the inputs and the outputs, It's almost as if you could sort of drive a hidden LRU cache equivalent at the cell level.
You know what I mean?
That's exactly right.
Yeah.
I think, yeah, because we know the inputs and outputs, that's kind of how everything flows from a project.
You can think about projects like if you turn a notebook into a data flow graph, what can you do?
And yeah, caching is, smart caching is definitely one of them.
Yeah.
I mean, it's not a, I make a sense like, well, you know, the inputs, outputs, so it's fine.
But, you know, you could have the same data frame, but you could have added a column to the data frame, and the LRU cache goes, is it the same pointer?
It is.
We're good to go.
It's like, well, yes.
However,
it's
not the same.
You know, you almost got to, like, hash it or do something funky.
Yeah, it's not perfect.
Automatic sounds hard.
No.
Yeah, yeah, exactly.
That's why we haven't quite enabled it.
Yeah, it is hard.
Yeah.
Side effects, too, network requests, all these things.
All right.
I have three more topics I want to cover before we run out of time here.
We may cover more, but three are required.
First one, because this is the one I'm going to forget most likely.
You were at Google, and then by way of going through a PhD, you now are not at Google creating this project, which is open source on GitHub.
And I don't see a pricing page at the top, but I do see it for enterprises.
Like, how is this sustaining itself?
Like, what's the business model?
So
when we first started right after my PhD, so that was early 2022, we were actually lucky enough to get funding from a national lab associated with Stanford.
So the Stanford Linear Accelerator.
So I was talking with
some scientists there
and we were talking about, I knew I wanted to make this thing.
And they were like, what are you up to?
And I was like, oh, well, I want to make this like notebook thing that like, you know, fixes all notebooks inspired by Pluto JL.
And they were like, that's awesome.
We're scientists.
We use notebooks every day and we're getting a little tired of reproducibility issues.
We want to make apps.
So they're like, we'll fund you to do this.
And so we...
Awesome.
So they kind of wrote you into one of their larger grants, something like that.
We got like a subcontract that like was covered by one of their grants.
Yeah.
So that wasn't enough for me and my co-founder, Miles, to work on it for two years full time alone.
And like, I think it really let us polish the product and develop
it.
And then mid
last year, in July. One of our users is like one of our probably biggest power users actually is Anthony Goldblum, who is the founder and former CEO of Kaggle. So
really
into data science. So he's been one of our biggest power users. And at a certain point he last year became, I guess, passionate enough about our project that he reached out to us and asked us, hey, like, can this venture fund I'm part of, can we invest?
And so that was July of last year.
And so we raised money from them as well as from a bunch of prominent angel investors like Jeff Dean from Google, Clem from Hugging Face, Lucas B.
Walt from Weights &
Bias and others.
So now our team is funded primarily through the venture funding.
Right now our business model is build open source software based on our venture
funding.
We do have plans for commercialization, but we're just not at a point where it makes sense to work on that right now.
But what I can promise is that Marima will always be open source Apache 2.0 license.
We never plan to sell the notebook itself, but instead plan to work on complementary infrastructure.
Yeah, I can already think of two good ones.
Cool.
Yeah.
Awesome.
Okay. The reason I ask is, you know, people always just want to know either
how,
what is kind of the success story of open source, but sustainable, you know, as a full-time thing, or if they're buying into it, how likely is that going to stay open source or like what's the catch, you know, that kind of stuff?
Yeah, no, it's a good question.
I mean, honestly, I think when we raised money, it actually assuaged some of our users because they were like, oh, Miles and Akshay are really cool.
They're building this really cool stuff, but how are they paying rent?
And so when we told them, yeah, we raised a few million dollars from X Ventures, they were like, okay, that's great.
You deserve it.
Please continue building.
Nice.
Yeah.
Yeah, that's awesome.
All right.
Let's see, which one are we going to talk about next?
Not
this one yet.
We'll talk about this because there's a nice comment from Amir out in the audience.
I love the new AI feature in Mario.
So you have an AI capability.
And then the other thing I want to talk about is, so we save some time for it, is publishing or running your Reactive Notebook as an app.
But let's talk AI first because we started the show that way.
I don't want to start to
round it
out that way, you know?
So we have like a few different ways that AI is, I guess, integrated into the project.
So one thing that we're trying really hard to do is like build like a modern editor, like designed specifically for working with data.
And I think these days modern means one of the requirements is you have AI stuff built in.
So you can like generate code with AI.
You can like even tell the, you can like tag like data frames and like tables that you have in memory and like give them as context, give their schemas as context to your assistant.
in
like a cursor-like way.
We're also like experimenting with a new service right now like marimo.amp.ai where you can go type a little prompt like generate me a notebook that plots a 3D quadratic surface with Matplotlib because I always forget how to do that.
And then it'll do its best to in one shot create that notebook for you and then you can play around with it and then you can either download it locally or share it out.
Yeah, very cool.
I'll put a link to the online AI feature that people can play with.
It looks really, really nice and it worked super quick when I asked it to go.
Now, one thing I want to talk about really quick now that I'm looking at this is you've got the code, but it's below the presentation of the result of the code.
Yeah.
So that is a stylistic choice, which is configurable because people told us, Many of them told us we don't like this.
Please just put the output below.
But
other people like it.
Okay, you love
it.
Okay, yeah.
And so this
is...
Okay, well, what is the point?
Is the point for me to see the code or the answer?
The point is to see the graph and the tables and
if I care,
I'll look at the code.
So the way that I...
So I think I mentioned Pluto JL really briefly.
So Pluto JL is one of our biggest inspirations.
It's a Julia project, a reactive notebook.
Now, a lot of the great ideas that I think are great about Marimo came, honestly, very straight from pluto and one thing that fawns like the creator of pluto's you know he likes to say is he said code is the code of a cell is a caption for its output and that's the that's the way you think about it and when you think about it that way it makes a lot of sense um but i think like pluto and then observable also both have outputs on top i don't know it's like i feel like if you it's like one of those heuristics you look at a notebook output on top it's a reactive notebook otherwise it's imperative
i gotcha gotcha yeah i can see why you might not like it but i like it so i think
it's pretty
cool yeah and then this um marmo.app slash ai once you create one of these you have a shareable link that you can hand off to other people right yeah
so you can open a new tab which i think will so actually this all of this actually interestingly enough is running in our WebAssembly playground um
yeah so there's
that url right there which you can just share You can also do like the little, there's a hamburger menu, which you can click on to get a permalink that's shorter.
But
yeah,
honestly, we just built this generate with AI feature like a little over a week ago.
And just curious to see what people use it for.
There's a
lot more we could invest
here.
I mean, you know, everyone talks about agents.
You can think about, oh, data science agent.
But for now, we're just trying to one shot thing and see how it lands with folks.
Yeah, sure.
Let's start with that.
Well, it looks really great.
And the UI is super nice.
So well done.
Appreciate it.
I'll pass that on to Miles.
He built this as a weeknight project.
Sometimes you just get inspired.
Just like, you know what?
I'm doing it.
I'm just taking
two days off the regular work and I'm just doing this.
You know what I
mean?
Yeah.
Yeah, definitely.
Yeah.
All right.
So the final thing I want to talk about, which you kind of hinted at a little bit there with the WebAssembly stuff, is I want to run my app.
So tell us about, as I'm fumbling around to find a place to show you.
Anyway, tell us about running the app.
Yeah, so there's
a few different ways.
The sort of traditional way, if you have a client-server architecture,
so you have your notebook
file, notebook.py.
It has some UI elements, et cetera.
It has some code.
You get an app, but just by default, you hide all the code.
Now you have text, outputs, UI elements.
You can think of it as an app.
So if you type marimorun, notebook.py, at the command line, it'll start a web server that's serving your notebook in a read-only session that you can connect to, et cetera.
Can you do the widgets?
Like if it's read-only, can I slide the widgets to see it do stuff?
You know what I mean?
Yeah,
yeah, yeah.
So you can slide the widgets, see it do stuff.
You just can't change the underlying Python code.
Like you can't like,
got it.
But yes, that's true.
That is
real.
Exact RM dash RF.
Okay.
Let's go.
Yeah.
So that is not allowed.
And so that's the traditional way client server.
Um, but, last year we actually, I think it was last year.
Uh, we, we added support for, WebAssembly through the PyDype project, which is a port of CPython to, to Wasm slash Unscriptum.
And so now you can actually take any Marima notebook.
And as long as you satisfy some constraints, which are documented on our website, you can export it as like static HTML and some assets and just throw it up on GitHub pages or server it wherever you like.
And that's also what our online playground is powered by.
And we found this to be just like a really easy way to share notebooks, easy for folks in industry, easy for educators, and also just incredibly satisfying.
In our docs, we have tons of little Marima notebooks iframed into various API pages, etc., that just let you actually interact with the code as opposed to just reading it statically.
Yeah, that's nice.
That's super cool.
So it's pretty low effort, it sounds like.
And it's a lot of work to run a server and maintain it, especially if you're going to put it up there so other people can interact with it.
And you've got to worry about abuse and all that kind of stuff.
If you can ship it as a static website, people are just abusing themselves if they mess with it anyway.
Exactly.
I had to give huge props to the PyDive maintainers.
They are amazing, really responsive, and just building this labor of love.
They are really pushing the needle on the accessibility of Python.
Yeah, that's awesome.
Have you done anything with PyScript?
I haven't done anything with it.
I know of them.
So they also use Pyodide underneath the hood.
Yeah, they let you
pick between Pyodide for more data science-y stuff and
MicroPython for more faster
stuff.
I am pretty not educated about MicroPython.
I read about it, but I'd be curious on your take also on choosing one versus the end.
Yeah, well, I think it's brilliant if you want a front-end framework equivalent.
If you want PyView or PyReact or whatever,
You don't
need all the extras.
You kind of need the Python language and a little bit of extras and the ability to call APIs, right?
And so MicroPython is a super cut-down version that's built to run on like little tiny chips and self-contained systems on a chip type things.
So it's just way lighter.
It's 100K versus 10 megs or something like that.
And if
it solves the problem, right, if it gives you enough Python, I guess is the way to think of it, then it's a really cool option for front-end things.
I don't know that it works for you guys, right?
Because you want as much compatibility with like Matplotlib
and Seaborn
and all these things.
But if your goal is like, I want to replace the JavaScript language with the Python language, and I know I'm in a browser, so I'm willing to make concessions, I think it's a pretty good option.
Yeah, that makes sense.
Yeah, you're right.
We want max compatibility.
Like we have one demo where like you can load sklearn, take PCA of these like images of numerical digits, put it in all Terraplot, select them, get it back as a data frame.
That's all running in the browser.
And, like,
it's magical.
It's on your home screen.
People can watch the little
embeddings
explore.
It's super cool.
It's very cool.
It's honestly magical what PyDat has been able to enable.
Yeah.
I imagine it's just getting started.
I think so.
Yeah.
They're constantly shipping.
They just added support for Wasm GC.
So performance is increasing.
Expose
the bug
in WebKit.
along the way.
Wow, okay.
That's good.
Yeah.
Cool.
All right, well, we're getting to the end of our time here.
So, you know, people are interested in this.
They might want to try it for themselves.
Maybe they're part of a science team or a data science team at a company.
What do you tell them if they're interested in Marmo and they want to check it out?
The easiest way, I think, is to just start running it locally.
And so our sort of source of truth is our GitHub repo.
So github.com, marimoteam.com, or if it's easy to remember, our homepage is marimo.io, which links to our GitHub.
But then you can install from pip or UV or whatever your favorite package manager is and just sort of go to town.
If you really just don't have the ability to do that for whatever reason, you can go to marimo.new, which will create a blank Marimo notebook powered by WebAssembly in your browser.
It has links to various Marimo tutorials, as an example, notebooks.
We didn't even get to talk about the UV integration, which may be another time, but that's another way that Marimo makes notebooks reproducible down to the packages.
Oh, yeah, okay.
UV is fantastic.
I'm a huge fan of UV and Charlie Marsh and team.
Yeah, but GitHub, Marimo.io, and docs.marimo.io is what I would recommend.
Thank you so much for being on the show.
Congratulations on the project.
It's really come a long way, it sounds like, so it looks great.
Thanks, Michael. I appreciate it.
It was a lot of fun to chat.
Yeah, you bet. Bye.
Bye.
This has been another episode of Talk Python to Me.
Thank you to our sponsors.
Be sure to check out what they're offering.
It really helps support the show.
This episode is sponsored by Worth Recruiting.
Worth Recruiting specializes in placing senior-level Python developers and data scientists.
Let Worth help you find your next Python opportunity at talkpython.fm/worth.
Want to level up your Python?
We have one of the largest catalogs of Python video courses over at Talk Python.
Our content ranges from true beginners to deeply advanced topics like memory and async.
And best of all, there's not a subscription in sight.
Check it out for yourself at training.talkpython.fm.
Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days.
If you want to be part of the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.