Latest / Talk Python To Me / #501: Marimo - Reactive Notebooks for Python
Transcript
- 0:00Have 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?
- 0:08Today's guest has a fresh take on solving that exact problem.
- 0:12Akshay Agrawal is here to introduce Marimo, a reactive Python notebook that ensures your code and outputs always stay in lockstep.
- 0:20And that's just the start.
- 0:21We'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.
- 0:33This is Talk Python To Me, episode 501, recorded Thursday, February 27th, 2025.
- 0:41Are
- 0:41you ready for your host, please?
- 0:43You're listening to Michael Kennedy on Talk Python To Me.
- 0:46Live from Portland, Oregon, and this segment was made with Python.
- 0:53Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:56This is your host, Michael Kennedy.
- 0:58Follow 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.
- 1:12If you want to be part of our live episodes, you can find the live streams over on YouTube.
- 1:16subscribe to our YouTube channel over at talkpython.fm/youtube and get notified about upcoming shows.
- 1:23This episode is sponsored by Worth Recruiting.
- 1:26Worth Recruiting specializes in placing senior level Python developers and data scientists.
- 1:31Let Worth help you find your next Python opportunity at talkpython.fm/Worth.
- 1:36Akshay, welcome to Talk Python To Me. Awesome to have you here.
- 1:39Thanks, Michael. Really happy to be here.
- 1:41Yeah, it's data science hour, isn't it?
- 1:44Yeah, I guess it is.
- 1:46In a sense, but also in a sense, kind of bringing data science a little closer to traditional, formal computer science or more.
- 1:55I don't know.
- 1:55I don't know what to think about computer science.
- 1:57Software engineering.
- 1:58Software engineering.
- 1:59Yeah, that's our goal.
- 2:00Blending data science with sort of the rigor reproducibility of software engineering.
- 2:05Yeah.
- 2:05And I think people are going to find it pretty interesting.
- 2:08It's definitely gained a lot of traction lately.
- 2:10So it's going to be really fun to dive into Marimo.
- 2:13Before we do, though, who are you?
- 2:15What are you doing here? Tell people about yourself.
- 2:18Sure. So I'm Akshay. I'm one of the co-founders and developers of Marimo.
- 2:24I 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.
- 2:35And before that, I was at Google Brain where I worked on TensorFlow.
- 2:39And 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.
- 2:51And for the
- 2:52past few years,
- 2:52it's been the first hat.
- 2:54So 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.
- 3:05Well, that's very cool.
- 3:06You've been right at the cutting edge of this whole machine learning thing, I guess, right?
- 3:11If you go back a handful of years, it's different today than it was five years ago.
- 3:16Oh, yeah.
- 3:16It's very different.
- 3:17I was at Google Brain 2017 to 2018.
- 3:21So I think we had Transformers, but we didn't really appreciate all that they could do.
- 3:27Yeah.
- 3:29But 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.
- 3:37And 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.
- 3:47And 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.
- 3:54Yeah, I bet it was.
- 3:55Well, you know, that's such an interesting background.
- 3:58I think maybe give people a sense of what is Google Brain and all that and maybe just Transformers, right?
- 4:04It's the foundation of so much surprising and unexpected tech these days.
- 4:12Yeah, yeah, I'm happy to.
- 4:14So Google Brain, what is Google Brain?
- 4:16So I guess technically Google Brain no longer exists as it did back then.
- 4:20Now it's just DeepMind with DeepMind and Google Brain merged.
- 4:23But back then Google Brain was, so there was, I guess, two researchers under the alphabet umbrella, Google Brain and DeepMind.
- 4:31And Google Brain was a place where it was really special.
- 4:34So there were folks working on all kinds of research projects from you, like using transformers for code generation, but also like systems research projects.
- 4:42Like I was there when
- 4:43the JAX
- 4:45machine learning library, which is an alternative to TensorFlow and PyTorch, was still being in the early days of development.
- 4:51And I was able to meet with like Roy Frostig, Matt Johnson.
- 4:56And that was really cool sort of coming up to speed on machine learning systems in that era.
- 5:03I 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.
- 5:16Did you feel bad when you used PyTorch?
- 5:18You're like, oh, I'm cheating.
- 5:20No, no.
- 5:21I mean, a little, I guess.
- 5:23But, you know, it's the thing like everyone else used PyTorch.
- 5:27And we had just started working
- 5:28on TensorFlow
- 5:29too when I joined, whereas PyTorch had already been mature.
- 5:31So it was the responsible thing to do.
- 5:36And
- 5:36Transformers,
- 5:38what are these Transformer things?
- 5:39They came out of Google, right?
- 5:41Yeah, yeah, they did.
- 5:42Attention is all you need.
- 5:45These Transformer things, I guess, are the backbone of all these large language models that we're seeing today.
- 5:51And they proved to have like an incredible capacity for modeling, I guess, in a generative way, all kinds of text.
- 5:59And in a way that, honestly, if I had to admit, surprised me.
- 6:03At the time in 27 to 18, we were doing good work in machine translation and stuff.
- 6:08But 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.
- 6:20I put on my systems engineer hat back then, and I was a little skeptical, to be honest.
- 6:24And I've just totally proved wrong, and I'm happy to have been proved wrong.
- 6:28So it's been phenomenal seeing sort of that, the success of that particular model.
- 6:34And yeah, having
- 6:35quite a small
- 6:36part in it.
- 6:37Yeah, 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.
- 6:43It'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.
- 6:55And just,
- 6:55I
- 6:56mean, it was interesting.
- 6:57it looked kind of relevant and possibly useful in some of the cases, but not like it is today.
- 7:02Like 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.
- 7:13I'm all about it these days.
- 7:15I 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.
- 7:27And then maybe we'll go to Google if we don't get a good answer, you
- 7:29know?
- 7:29Yeah.
- 7:30No, no, I'm the same way.
- 7:31I spent more time than I care to admit last night migrating from Vim to NeoVim.
- 7:37And 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.
- 7:49And you
- 7:49can ask it detailed questions, right?
- 7:51For example, I
- 7:52needed some way to reset the initial offset in DaVinci Resolve timelines.
- 7:56It was, okay, well, here's your four options, and these are the way you can do it, and these are the tradeoffs.
- 8:00It's not just you might get an, you know, here is the switch, but you get an analysis.
- 8:05And I'm pretty impressive.
- 8:08So 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.
- 8:20Upwards, not logarithmic.
- 8:22Yeah.
- 8:23I 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.
- 8:39You know, it was important to understand what a loss function, like basic things, like what a
- 8:42loss function was,
- 8:43what's training, what's validation.
- 8:46These days, like, you don't need to, like, at all, actually.
- 8:49I think especially to use LLMs, right?
- 8:52Like, you just need to know inputs and outputs.
- 8:54It's like a function call that sort of has fuzzy outputs.
- 8:57You know,
- 8:57it's a mathematical
- 8:58function in quotes.
- 9:00Yeah.
- 9:01So
- 9:01I think that's one thing that's totally...
- 9:04I 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
- 9:13really needing
- 9:14to understand how it works.
- 9:18As for the trajectory, I've been bad at making predictions in the past.
- 9:22I think I will be bad at predicting anything right now.
- 9:26Surely, these models are very good for coding.
- 9:31for 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.
- 9:56Yeah. 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.
- 10:08Yeah. I mean, even local models, like it's kind of exciting, like what you can just run on your Mac book.
- 10:13I also
- 10:13didn't really anticipate that. yeah.
- 10:16All right. I don't want to make this the AI show cause it's not about
- 10:18AI,
- 10:19but 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
- 10:50i 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
- 10:59the yeah the
- 11:00i 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.
- 11:21I did things like adding support to TensorFlow for creating a function library.
- 11:27TensorFlow 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.
- 11:38I know it was a lot of compute, but a lot versus a lot, all
- 11:43caps versus just capital case.
- 11:46Yeah,
- 11:47I'm sure
- 11:47there's a delta.
- 11:48I just, I don't know how much.
- 11:49Yeah.
- 11:50Well, today they're all talking about restarting nuclear reactors and plugging them straight to the data center.
- 11:55So it's a weird time.
- 11:57Let's go back.
- 11:59Maybe a little bit before then, 2012 or so, I believe is maybe the right timeframe.
- 12:05And let's talk about notebooks.
- 12:07And, you know, around then, Jupyter notebooks burst on the scene.
- 12:12And I think they fundamentally changed the ecosystem of Python and basically scientific work in general, right?
- 12:22By changing Python, I mean, there are so many people in Python who are here because they got pulled into a notebook.
- 12:28They wrote a little bit of code.
- 12:30They got incredible results.
- 12:32They were never, ever a programmer, but now they're the maintainer of an open source project or something like that.
- 12:36You know what I mean?
- 12:38They're just like, oh, this is kind of neat.
- 12:40oh 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
- 12:54yeah jupiter was essentially the start of it especially for python like I think
- 12:58the idea of computational
- 12:59yeah 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.
- 13:25Yeah.
- 13:26Going back to that sixth cell you entered on your REPL and editing it, that is not a way to draw beginners in.
- 13:35No, definitely not.
- 13:37Up arrow key six times, no.
- 13:38Yeah, 2012, coincidentally, is when I started college as an undergrad.
- 13:44So I had been using, I kind of grew up, as long as I used Python, I think I probably was using Jupyter Notebooks.
- 13:52And 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.
- 14:03So, yeah, notebooks have sort of shaped the way that I think and interact with code quite a bit.
- 14:09Yeah, absolutely.
- 14:11So maybe you could give us some perspective.
- 14:14It sounds like you were there, like, right at the right time.
- 14:16You know, what was the goal and sort of the job of Jupyter Notebooks and those kinds of things then?
- 14:23And how has that changed now?
- 14:25And maybe how does it still solve that problem or not solve it so much?
- 14:29Yeah, I think, so stepping back.
- 14:32So 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.
- 14:41And I think that's like really, I think you're onto something there.
- 14:43I think that's correct.
- 14:44And 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.
- 14:55And that interactivity in particular, I think is really important for anyone who works with data.
- 15:01It'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.
- 15:14Right. 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.
- 15:23And 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.
- 15:34It let them rapidly experiment with code and models and importantly, get some kind of like artifact out of it.
- 15:45And in particular, this was like a static HTML type artifact, right, where you have some text documenting what experiments you're running.
- 15:53you have Python code, and then you have like Matplotlib plots and other artifacts.
- 15:59And I think for the sciences in particular early on, that was super important and transformative.
- 16:07And we were talking about other computational notebook environments.
- 16:10And it's interesting to mention this because things like this existed sort of before, like Mathematica's workbooks, I think they
- 16:17called them.
- 16:17I might have
- 16:17done that wrong.
- 16:19But I think just like the open source nature of Python and the accessibility of it just like made it way easier to get started.
- 16:26And 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.
- 16:37And insofar as like what they're used for today, they're used for a lot.
- 16:41It's kind of remarkable how much they're used.
- 16:44Like I remember seeing a statistic for Google CoLab alone, which is just one particular hosted version of a Jupyter notebook.
- 16:53And it was two years ago, and they said something about like having 10 million monthly active users.
- 16:58And so the number of people who use Jupyter on a monthly basis is surely larger than that.
- 17:04Oh, yeah.
- 17:05And 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.
- 17:14So they're increasingly used for like data pipelines and like ETL jobs.
- 17:19And like, so anyone who's in Databricks, for example, runs like, they call them workflows, Databricks workflows, through essentially Jupyter Notebooks.
- 17:29They're used for training machine learning models.
- 17:31Like I've trained many models in a Jupyter Notebook.
- 17:35I've developed algorithms in Jupyter Notebooks.
- 17:37I've produced scientific figures that go straight into my paper from a Jupyter notebook.
- 17:42And the reason people do this is because, again, the interactivity and the visuals that come out is very liberating compared to using a script.
- 17:51I think there's also a developing understanding that happens from them.
- 17:56Because 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.
- 18:02Whereas notebooks, it's like step one, step two.
- 18:05Let me look at it.
- 18:06oh, maybe that's different.
- 18:07Let me go back and change.
- 18:08It's more iterative from an exploratory perspective.
- 18:12Yeah, I think that's exactly right.
- 18:15Because you have that, when you're writing a software system, you kind of know the state of the system.
- 18:20You know what you want to change it to.
- 18:22But when you're working with data, there's that unknown, what will my algorithm do to my data?
- 18:26You
- 18:26just have
- 18:26to run
- 18:27it to find out.
- 18:27Yeah, absolutely.
- 18:28And graphs and tables and iterative stuff like that is really nice.
- 18:33So why create something instead of Jupyter?
- 18:37Why is Jupyter not enough for the world?
- 18:40Yeah.
- 18:41I think there's a...
- 18:42So just, you know, you're the creator of Marimo, along with the rest of the team and so on.
- 18:48But yeah, it's like, why create this thing when Jupyter exists?
- 18:53Yeah.
- 18:53So I think there's quite a few reasons.
- 18:58So Jupyter notebooks are like, I guess, It's more like Jupyter Notebooks powered by the IPython kernel, just to put a finger on it.
- 19:07Right, because it could be different.
- 19:08It could be like a C++ kernel or.NET kernel or whatever.
- 19:12Yeah, exactly.
- 19:13But 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.
- 19:27And 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.
- 19:38So like you run a cell, say you have three cells, you know, you decide to go rerun the second cell.
- 19:43You have to remember to rerun whatever cell depends on it.
- 19:47Maybe it's the third cell.
- 19:48Maybe it's the first cell because you wrote things out of order.
- 19:50And so you can easily get into a state with Jupyter Notebooks where your code on the page doesn't match the outputs that were
- 19:57created.
- 19:58Yeah. So if you were to like basically go to the menu option, say rerun all cells, you would get different answers.
- 20:03Exactly. And this is like it's actually been studied and like it happens a kind of a shockingly large amount of times that like.
- 20:11So there's one study in 2019 by Pimentel, I'm going to probably pronounce his name wrong, but by I think four professors.
- 20:20And they studied a bunch of notebooks on GitHub.
- 20:22And they found that only like a quarter of the notebooks that were on GitHub, they were able to run it all.
- 20:28And 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.
- 20:38Meaning like maybe people ran sales out of order when they originally created the notebook and then committed it.
- 20:45Or maybe they didn't like create a requirements.txt that faithfully captured the package environment they used.
- 20:53So 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.
- 21:07And so that was one issue.
- 21:08Reproducibility was like one main thing that sort of we wanted to solve for with Marima notebooks.
- 21:13And 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.
- 21:25And 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.
- 21:33So 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.
- 21:43You 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.
- 21:51And 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.
- 22:00And that was another thing we wanted to solve for, making notebooks like Git-friendly and interoperable with other Python tooling like Git, pytest, etc.
- 22:10Yeah, 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?
- 22:18Yeah, 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.
- 22:33But then like they just got used for so much more than that in situations where reproducibility, reusability is like really important.
- 22:41And I think that that's what we're trying to solve for.
- 22:45This portion of Talk Python To Me is brought to you by Worth Recruiting.
- 22:49Are you tired of applying for jobs and never hearing back?
- 22:53Have 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?
- 23:01You should reach out to Worth Recruiting.
- 23:04Worth Recruiting specializes in placing senior level Python developers and data scientists.
- 23:09They work directly with hiring managers at startups, helping them grow their software engineering and data science teams.
- 23:16with 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.
- 23:50The 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.
- 24:16If 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.
- 24:27I wonder if they're any better.
- 24:28Yeah,
- 24:29it's a good question.
- 24:31I think they will be better.
- 24:33I can just give an anecdote to why I think they would be better.
- 24:36And 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.
- 24:48And, you know, both of us did our, like created the examples for this embedding algorithm in like Jupyter Notebooks.
- 24:57And these notebooks produced a bunch of plots, et cetera.
- 25:00And so at the end of the, once the thesis was written, I was putting up all our code on GitHub.
- 25:04And so I asked one of my co-authors, like, hey, like, can you share your notebooks with me?
- 25:09And this co-author is amazing.
- 25:10He's really smart, but not necessarily trained as a software engineer.
- 25:14And he shares his Jupyter notebook with me.
- 25:16And I run it.
- 25:17It doesn't work at all.
- 25:19And the reason it doesn't work at all is that there's like multiple cells.
- 25:22And 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.
- 25:29And it's not like
- 25:29one,
- 25:30two, three, four.
- 25:31It's like one, two, seven, four.
- 25:33It's like
- 25:33these cells were
- 25:34ran in this path dependent way.
- 25:36And then also it's like there's like three cells in the middle.
- 25:39He ran just one of them.
- 25:40I'm not exactly sure which one.
- 25:42And like, whereas if you had a Python script, there's only one way to, I mean, sure, you can have
- 25:46data files.
- 25:46That's a good point.
- 25:47You do not really get a choice.
- 25:49It runs
- 25:50top to bottom.
- 25:51Exactly.
- 25:51Depending
- 25:51on the data.
- 25:52Okay.
- 25:53So yeah,
- 25:53that is something that's really, it's just very counter to the concept of reproducibility is that you
- 26:00can
- 26:00run 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.
- 26:10warning across the top if it's not top to bottom.
- 26:14It doesn't have to be 1, 2, 3.
- 26:15It could be 1, 5, 6, 9.
- 26:17But it should be a monotonic increase in function as you
- 26:21do the numbers top
- 26:22to bottom.
- 26:24Otherwise, it should be like a big warning or like a weird, like some kind of indicator, like, hey, you're in the danger zone.
- 26:29You know what I mean?
- 26:30Yeah, 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.
- 26:40you 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.
- 27:07The first time this happened to me, it took me forever to debug.
- 27:11I
- 27:11can imagine
- 27:12that is so rough.
- 27:13Yeah.
- 27:13Later on, you realize, okay, this is a pattern that happens.
- 27:17But it's like, yeah, so that's another thing that we also wanted to solve for in Marimo notebooks.
- 27:23Awesome.
- 27:23All right.
- 27:23Well, tell us about Marimo.
- 27:26Okay.
- 27:27So let's see.
- 27:28So Marimo is, it's an open source notebook for Python.
- 27:31The main thing that's different between Marimo and Jupyter is that Marimo is reactive.
- 27:38And 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.
- 27:55So it's kind of like Excel, right?
- 27:56So you have two cells.
- 27:58One declares X.
- 27:59Another one references X.
- 28:00you 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.
- 28:09You can configure it if you're scared of automatic execution.
- 28:12But the point is that it manages your variables for you so
- 28:18that you
- 28:18don't have to worry about outputs becoming decohered from your code.
- 28:22And 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.
- 28:34So that reactivity provides some amount of reproducibility.
- 28:38And then it also, some of the key features, and then we can dive into each of them, is an additional reactivity.
- 28:44Marima notebooks are stored as pure Python files, which makes them easy to version with Git.
- 28:50And 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.
- 28:58Yeah, I'm excited to talk about that.
- 29:00Some cool stuff there.
- 29:01Okay, so when you create a variable, if you say like x equals one, it's not just a pi long pointer in memory, right?
- 29:09It'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.
- 29:21Who else is interested in reading from me?
- 29:23And it can sort of work that out, right?
- 29:25How does that work?
- 29:25Actually,
- 29:26it's not really implemented in that way.
- 29:29Okay.
- 29:30So, okay.
- 29:31So let's see.
- 29:32Yeah, this is interesting to dive into because there's like two ways that you can like get at reactivity.
- 29:37Like so in Marima, what we actually do is we do static analysis.
- 29:41So we
- 29:41look for
- 29:43definitions and references on like of global variables.
- 29:46And then so we just make a graph out of that.
- 29:48So for every cell, we look at the, I guess, the loads in the ASTs and then like
- 29:53the assignments.
- 29:57And so we can see statically who declares what and who reads what, but who is a cell.
- 30:04And so that makes it like performant and also predictable of like how your notebook is going to run.
- 30:10A alternative, I think what you were getting at was like runtime tracing.
- 30:14More like a JavaScript front end sort of deal, like a view binding model binding type thing or something like that.
- 30:20Yeah. So yeah, we, everything we do is static, is done with static analysis.
- 30:27this 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
- 30:39okay
- 30:40there'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.
- 30:58It's basically impossible to get 100% right.
- 31:00So you will miss some low references and definitions.
- 31:06And so there's this weird usability cliff as a user where when you run a cell, you're not sure what else will run.
- 31:12Whereas if you do it based on static analysis, you can give guarantees on what will run and what won't.
- 31:18Yeah, I guess the static analysis is a good choice because there's only so many cells.
- 31:23You 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.
- 31:32It's just like, when this cell runs, what other cells do we need to think about?
- 31:35So it's kind of like, what does this create?
- 31:38What does it change?
- 31:39And then push that along, right?
- 31:40So it's a little more constrained.
- 31:42Exactly, yeah.
- 31:43So basically, yeah, that's exactly right.
- 31:45And so it's a data flow graph where the data flowing on the edges is the variables across cells.
- 31:51Yeah, I don't know.
- 31:52I think I've been thinking about Dataflow Grass for a long time, ever since TensorFlow, doing my PhD too when I worked on CVXPY.
- 31:58So it's just a thing that I enjoy thinking about and working on.
- 32:02Yeah, well, what about your experience working on TensorFlow and at Google and at Stanford and stuff that sort of influenced this project?
- 32:11Yeah, a couple of things.
- 32:14So 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.
- 32:29And so really valued the iterative programming environment, really didn't like all the bugs that we kept on running into, which are
- 32:37like kind of our
- 32:37fault, right?
- 32:38Because of like, oh, we forget to run a cell, et cetera.
- 32:42Didn't like that it was not easy to reuse the code in a notebook in just other Python modules.
- 32:49Didn't like that I couldn't share my artifacts in a meaningful way with my PhD advisor who can't run Python notebooks.
- 32:55I couldn't make a little app to showcase my
- 32:58research project.
- 32:59It'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.
- 33:15It'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.
- 33:21Or, you
- 33:22know, just
- 33:22these little edge cases.
- 33:24Like, I was made to learn Fortran in college.
- 33:26I'm still sour about it.
- 33:29That's funny.
- 33:30Yeah, no, it's true.
- 33:31Yeah, it does have a big effect.
- 33:33And then at Google, I guess the things that influenced – so we used Notebooks 2 there.
- 33:39Since 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.
- 33:50But I guess the part of Google that influenced it was just like thinking about data flow graphs for a
- 33:55year. And you
- 33:56know, 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.
- 34:13And so I guess the part from there just made me not want to use runtime
- 34:18tracing,
- 34:19made me embrace static analysis for this.
- 34:22Yeah.
- 34:22Yeah, it makes a lot of sense.
- 34:24All right.
- 34:25Well, let's talk some features here.
- 34:27What 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?
- 34:37Yeah, that's correct.
- 34:38So the reactivity, in other words, the data flow graph behind it is the premier feature.
- 34:45And it lets you reason about your code locally, right, which is really nice.
- 34:48Like you can just look at your one cell.
- 34:49You don't really have to worry about, you know, you know what variables it reads and what it defines.
- 34:54And you don't have to worry about, oh, but what cells do I need to run before this?
- 34:58So not only does it like make sure your code and outputs are in sync, it also like makes it really like fun and useful.
- 35:08to really rapidly experiment with ideas.
- 35:11As 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.
- 35:27And 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.
- 35:40And the way that this works is that, so Marimo is like both a notebook and also a library.
- 35:47So you can import Marimo as Mo into your notebook.
- 35:50And 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.
- 36:12And 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.
- 36:31We just need to run all other cells that depend on X.
- 36:33all of a sudden you have really nice interactivity, interactive elements controlling your code execution without ever having to write a callback.
- 36:42And so I think people find that really liberating too.
- 36:44So you don't really have to hit backspace, change
- 36:47a
- 36:48character value for your variable, shift, enter, shift, enter, shift, enter.
- 36:52Just change a number and everything automatically recalculates.
- 36:56Yeah.
- 36:56In this dependency flow, is it possible to have a cyclical graph?
- 37:02Like 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.
- 37:09If I run it in the right order, it won't know that there's a problem.
- 37:13Imagine it's only possible to go one way, right?
- 37:16You can't get into a weird cycle.
- 37:19Yeah.
- 37:19So we do give people escape patches.
- 37:22We ask them, please don't use it unless you really know what you're doing and you really want to do this.
- 37:27Because 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.
- 37:40But 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.
- 38:07Please break your cycle.
- 38:08Here's some suggestions how to do that.
- 38:11But 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.
- 38:20You can update a state object and kind of in a React from 10D way, it'll run dependence of that state.
- 38:26Okay, interesting.
- 38:27Yeah, I guess that makes sense for apps.
- 38:28You definitely need some sort of global state there.
- 38:32Yeah, I
- 38:34think we've seen that sometimes our users will reach for state in call VIX just because that's what they're used to.
- 38:41And that's what they maybe were required to use in Jupyter, et cetera.
- 38:45So we're trying to tell them, hey, in most cases, you actually don't need this.
- 38:49Yeah, very cool.
- 38:50So when you create a Jupyter notebook, you don't really create Python files.
- 38:56you 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.
- 39:05That'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?
- 39:16Yeah.
- 39:17If you guys do Python
- 39:18files, do you have a way to save that state in a sort of presentation style or something like that?
- 39:26You know what I mean?
- 39:26Is there like an associated state file?
- 39:29Yeah,
- 39:30so that's a really good question.
- 39:31And the answer is yes, but that is the biggest trade-off, I think, of our file format.
- 39:35So 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.
- 39:47Like that's like, they're like, that's the one reason I, especially like people in software and industry.
- 39:52And then they stay for all the other things.
- 39:55So that's what the pure Python file format allows, in addition to modularity, running it as a script.
- 40:02For seeing outputs, yeah, they're not saved in the Python file.
- 40:05So we have a couple of ways to get around that.
- 40:09So one, you can export any Marimo notebook to an IPython notebook file, actually.
- 40:14So you
- 40:14can set up this, we have a feature, automatic snapshotting.
- 40:18You can automatically snapshot your notebook to like a parallel IPIMB file that's stored in a subdirectory of your notebook folder.
- 40:28And so you can push that up or share that if you like.
- 40:32When 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.
- 40:45The representation of the outputs are saved in this subdirectory, underscore underscore marimo.
- 40:51So 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.
- 41:01So
- 41:01I see. So kind of like PyCache.
- 41:04Yeah.
- 41:04I would actually assume given the name, but I haven't actually looked into PyCache too much.
- 41:09Well, I mean, just in the sense that it's saved like right there in your project using that directory.
- 41:14Oh, yes, yes. You have a PyCache folder. Exactly.
- 41:16Yeah,
- 41:17yeah, yeah. Exactly.
- 41:18And we have one
- 41:18other 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.
- 41:32So it'll actually save the Python objects themselves using a variety of different protocols.
- 41:40And because we have the DAG, he can actually guarantee consistency of the cache.
- 41:47But that
- 41:47means not only are your outputs
- 41:49automatically loaded, also the variables are loaded, so you can literally pick up where you left off.
- 41:54Yeah, it sounds like some sweet SQLite could be in action there instead of just flat files or whatever.
- 42:01Yeah.
- 42:02Yeah, very cool.
- 42:02So you talked about when the reactivity fires, it can sometimes be expensive to recompute the cells.
- 42:10Sometimes they're super simple.
- 42:12Sometimes they're trained in the machine learning model for two days.
- 42:16Yeah.
- 42:17Are there caching mechanisms?
- 42:19You 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.
- 42:33And 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?
- 42:43Is there a way to set up that kind of caching or performance memoization type stuff?
- 42:50Yeah, definitely.
- 42:51And that same contributor, Dylan.
- 42:53So he's implemented these and is continuing to build it out.
- 42:57But we have, I guess, two options.
- 43:02One 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.
- 43:10If you use functools.cache naively, if a cell defining a function reruns, your cache gets busted.
- 43:18So modoc.cache is a little smarter, and using the DAG can know whether or not it needs to bust the cache.
- 43:25But to the user, it feels the same.
- 43:28And 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.
- 43:37And so you can put an entire cell in a context manager with MoDub persistent cache.
- 43:44It'll sort of do the right thing.
- 43:46We've been talking about experimenting with letting users opt into global cell-wide caching, just automatically memorize cells or just have a UI element
- 43:55to do something like that.
- 43:57But we haven't quite done that yet.
- 43:59Yeah, I mean, it sounds real tricky for Jupyter.
- 44:01But 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.
- 44:11You know what I mean?
- 44:12That's exactly right.
- 44:13Yeah.
- 44:14I think, yeah, because we know the inputs and outputs, that's kind of how everything flows from a project.
- 44:19You can think about projects like if you turn a notebook into a data flow graph, what can you do?
- 44:24And yeah, caching is, smart caching is definitely one of them.
- 44:27Yeah.
- 44:27I mean, it's not a, I make a sense like, well, you know, the inputs, outputs, so it's fine.
- 44:32But, 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?
- 44:39It is.
- 44:40We're good to go.
- 44:40It's like, well, yes.
- 44:41However,
- 44:42it's
- 44:43not the same.
- 44:44You know, you almost got to, like, hash it or do something funky.
- 44:47Yeah, it's not perfect.
- 44:48Automatic sounds hard.
- 44:49No.
- 44:50Yeah, yeah, exactly.
- 44:51That's why we haven't quite enabled it.
- 44:54Yeah, it is hard.
- 44:56Yeah.
- 44:56Side effects, too, network requests, all these things.
- 44:59All right.
- 45:00I have three more topics I want to cover before we run out of time here.
- 45:04We may cover more, but three are required.
- 45:07First one, because this is the one I'm going to forget most likely.
- 45:10You 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.
- 45:20And I don't see a pricing page at the top, but I do see it for enterprises.
- 45:24Like, how is this sustaining itself?
- 45:27Like, what's the business model?
- 45:29So
- 45:30when 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.
- 45:42So the Stanford Linear Accelerator.
- 45:44So I was talking with
- 45:45some scientists there
- 45:46and we were talking about, I knew I wanted to make this thing.
- 45:50And they were like, what are you up to?
- 45:51And I was like, oh, well, I want to make this like notebook thing that like, you know, fixes all notebooks inspired by Pluto JL.
- 45:57And they were like, that's awesome.
- 45:59We're scientists.
- 45:59We use notebooks every day and we're getting a little tired of reproducibility issues.
- 46:03We want to make apps.
- 46:04So they're like, we'll fund you to do this.
- 46:06And so we...
- 46:07Awesome.
- 46:07So they kind of wrote you into one of their larger grants, something like that.
- 46:11We got like a subcontract that like was covered by one of their grants.
- 46:14Yeah.
- 46:15So that wasn't enough for me and my co-founder, Miles, to work on it for two years full time alone.
- 46:21And like, I think it really let us polish the product and develop
- 46:26it.
- 46:27And then mid
- 46:28last 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
- 46:40really
- 46:41into 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?
- 46:58And so that was July of last year.
- 47:00And 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.
- 47:09Walt from Weights &
- 47:10Bias and others.
- 47:12So now our team is funded primarily through the venture funding.
- 47:18Right now our business model is build open source software based on our venture
- 47:22funding.
- 47:23We do have plans for commercialization, but we're just not at a point where it makes sense to work on that right now.
- 47:28But what I can promise is that Marima will always be open source Apache 2.0 license.
- 47:33We never plan to sell the notebook itself, but instead plan to work on complementary infrastructure.
- 47:39Yeah, I can already think of two good ones.
- 47:43Cool.
- 47:44Yeah.
- 47:45Awesome.
- 47:45Okay. The reason I ask is, you know, people always just want to know either
- 47:49how,
- 47:51what 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?
- 48:06Yeah, no, it's a good question.
- 48:08I 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.
- 48:18They're building this really cool stuff, but how are they paying rent?
- 48:22And so when we told them, yeah, we raised a few million dollars from X Ventures, they were like, okay, that's great.
- 48:28You deserve it.
- 48:29Please continue building.
- 48:31Nice.
- 48:32Yeah.
- 48:33Yeah, that's awesome.
- 48:34All right.
- 48:35Let's see, which one are we going to talk about next?
- 48:37Not
- 48:38this one yet.
- 48:39We'll talk about this because there's a nice comment from Amir out in the audience.
- 48:42I love the new AI feature in Mario.
- 48:44So you have an AI capability.
- 48:47And 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.
- 48:55But let's talk AI first because we started the show that way.
- 48:59I don't want to start to
- 48:59round it
- 49:00out that way, you know?
- 49:02So we have like a few different ways that AI is, I guess, integrated into the project.
- 49:08So one thing that we're trying really hard to do is like build like a modern editor, like designed specifically for working with data.
- 49:15And I think these days modern means one of the requirements is you have AI stuff built in.
- 49:20So you can like generate code with AI.
- 49:22You 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.
- 49:32in
- 49:32like a cursor-like way.
- 49:35We'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.
- 49:51And 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.
- 50:04Yeah, very cool.
- 50:05I'll put a link to the online AI feature that people can play with.
- 50:09It looks really, really nice and it worked super quick when I asked it to go.
- 50:12Now, 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.
- 50:22Yeah.
- 50:23So that is a stylistic choice, which is configurable because people told us, Many of them told us we don't like this.
- 50:30Please just put the output below.
- 50:31But
- 50:32other people like it.
- 50:33Okay, you love
- 50:33it.
- 50:34Okay, yeah.
- 50:34And so this
- 50:35is...
- 50:35Okay, well, what is the point?
- 50:36Is the point for me to see the code or the answer?
- 50:39The point is to see the graph and the tables and
- 50:42if I care,
- 50:43I'll look at the code.
- 50:44So the way that I...
- 50:46So I think I mentioned Pluto JL really briefly.
- 50:49So Pluto JL is one of our biggest inspirations.
- 50:51It's a Julia project, a reactive notebook.
- 50:54Now, 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
- 51:23i gotcha gotcha yeah i can see why you might not like it but i like it so i think
- 51:30it's pretty
- 51:31cool 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
- 51:40so 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
- 51:48yeah so there's
- 51:49that 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.
- 51:58But
- 51:59yeah,
- 52:01honestly, we just built this generate with AI feature like a little over a week ago.
- 52:05And just curious to see what people use it for.
- 52:08There's a
- 52:08lot more we could invest
- 52:09here.
- 52:10I mean, you know, everyone talks about agents.
- 52:12You can think about, oh, data science agent.
- 52:14But for now, we're just trying to one shot thing and see how it lands with folks.
- 52:19Yeah, sure.
- 52:20Let's start with that.
- 52:20Well, it looks really great.
- 52:21And the UI is super nice.
- 52:23So well done.
- 52:25Appreciate it.
- 52:25I'll pass that on to Miles.
- 52:26He built this as a weeknight project.
- 52:30Sometimes you just get inspired.
- 52:32Just like, you know what?
- 52:33I'm doing it.
- 52:34I'm just taking
- 52:35two days off the regular work and I'm just doing this.
- 52:38You know what I
- 52:38mean?
- 52:38Yeah.
- 52:39Yeah, definitely.
- 52:40Yeah.
- 52:41All right.
- 52:41So 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.
- 52:50So tell us about, as I'm fumbling around to find a place to show you.
- 52:55Anyway, tell us about running the app.
- 52:58Yeah, so there's
- 52:59a few different ways.
- 53:02The sort of traditional way, if you have a client-server architecture,
- 53:08so you have your notebook
- 53:09file, notebook.py.
- 53:12It has some UI elements, et cetera.
- 53:14It has some code.
- 53:15You get an app, but just by default, you hide all the code.
- 53:18Now you have text, outputs, UI elements.
- 53:20You can think of it as an app.
- 53:21So 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.
- 53:36Can you do the widgets?
- 53:40Like if it's read-only, can I slide the widgets to see it do stuff?
- 53:44You know what I mean?
- 53:44Yeah,
- 53:45yeah, yeah.
- 53:45So you can slide the widgets, see it do stuff.
- 53:47You just can't change the underlying Python code.
- 53:49Like you can't like,
- 53:50got it.
- 53:51But yes, that's true.
- 53:53That is
- 53:53real.
- 53:53Exact RM dash RF.
- 53:55Okay.
- 53:55Let's go.
- 53:56Yeah.
- 53:56Yeah.
- 53:57So that is not allowed.
- 53:58And so that's the traditional way client server.
- 54:01but, last year we actually, I think it was last year.
- 54:05we, we added support for, WebAssembly through the PyDype project, which is a port of CPython to, to Wasm slash Unscriptum.
- 54:14And so now you can actually take any Marima notebook.
- 54:17And 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.
- 54:28And that's also what our online playground is powered by.
- 54:31And 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.
- 54:39In 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.
- 54:52Yeah, that's nice.
- 54:53That's super cool.
- 54:54So it's pretty low effort, it sounds like.
- 54:57And 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.
- 55:04And you've got to worry about abuse and all that kind of stuff.
- 55:07If you can ship it as a static website, people are just abusing themselves if they mess with it anyway.
- 55:12Exactly.
- 55:13I had to give huge props to the PyDive maintainers.
- 55:19They are amazing, really responsive, and just building this labor of love.
- 55:24They are really pushing the needle on the accessibility of Python.
- 55:32Yeah, that's awesome.
- 55:33Have you done anything with PyScript?
- 55:35I haven't done anything with it.
- 55:37I know of them.
- 55:37So they also use Pyodide underneath the hood.
- 55:40Yeah, they let you
- 55:41pick between Pyodide for more data science-y stuff and
- 55:43MicroPython for more faster
- 55:45stuff.
- 55:47I am pretty not educated about MicroPython.
- 55:51I read about it, but I'd be curious on your take also on choosing one versus the end.
- 55:56Yeah, well, I think it's brilliant if you want a front-end framework equivalent.
- 56:01If you want PyView or PyReact or whatever,
- 56:05You don't
- 56:06need all the extras.
- 56:07You kind of need the Python language and a little bit of extras and the ability to call APIs, right?
- 56:12And 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.
- 56:22So it's just way lighter.
- 56:23It's 100K versus 10 megs or something like that.
- 56:26And if
- 56:27it 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.
- 56:35I don't know that it works for you guys, right?
- 56:37Because you want as much compatibility with like Matplotlib
- 56:41and Seaborn
- 56:42and all these things.
- 56:43But 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.
- 56:52Yeah, that makes sense.
- 56:53Yeah, you're right.
- 56:53We want max compatibility.
- 56:55Like 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.
- 57:05That's all running in the browser.
- 57:06And, like,
- 57:07it's magical.
- 57:08It's on your home screen.
- 57:09People can watch the little
- 57:10embeddings
- 57:12explore.
- 57:12It's super cool.
- 57:13It's very cool.
- 57:14It's honestly magical what PyDat has been able to enable.
- 57:18Yeah.
- 57:19I imagine it's just getting started.
- 57:21I think so.
- 57:22Yeah.
- 57:22Yeah.
- 57:23They're constantly shipping.
- 57:24They just added support for Wasm GC.
- 57:27So performance is increasing.
- 57:29Expose
- 57:30the bug
- 57:30in WebKit.
- 57:31along the way.
- 57:33Wow, okay.
- 57:34That's good.
- 57:35Yeah.
- 57:36Cool.
- 57:37All right, well, we're getting to the end of our time here.
- 57:40So, you know, people are interested in this.
- 57:42They might want to try it for themselves.
- 57:44Maybe they're part of a science team or a data science team at a company.
- 57:49What do you tell them if they're interested in Marmo and they want to check it out?
- 57:53The easiest way, I think, is to just start running it locally.
- 57:57And so our sort of source of truth is our GitHub repo.
- 58:01So GitHub.com, marimoteam.com, or if it's easy to remember, our homepage is marimo.io, which links to our GitHub.
- 58:09But then you can install from pip or uv or whatever your favorite package manager is and just sort of go to town.
- 58:15If 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.
- 58:25It has links to various Marimo tutorials, as an example, notebooks.
- 58:31We 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.
- 58:39Oh, yeah, okay.
- 58:41UV is fantastic.
- 58:42I'm a huge fan of uv and Charlie Marsh and team.
- 58:45Yeah, but GitHub, Marimo.io, and docs.marimo.io is what I would recommend.
- 58:51Thank you so much for being on the show.
- 58:52Congratulations on the project.
- 58:55It's really come a long way, it sounds like, so it looks great.
- 58:58Thanks, Michael. I appreciate it.
- 58:59It was a lot of fun to chat.
- 59:00Yeah, you bet. Bye.
- 59:02Bye.
- 59:03This has been another episode of Talk Python To Me.
- 59:06Thank you to our sponsors.
- 59:08Be sure to check out what they're offering.
- 59:09It really helps support the show.
- 59:11This episode is sponsored by Worth Recruiting.
- 59:14Worth Recruiting specializes in placing senior-level Python developers and data scientists.
- 59:19Let Worth help you find your next Python opportunity at talkpython.fm/worth.
- 59:25Want to level up your Python?
- 59:26We have one of the largest catalogs of Python video courses over at Talk Python.
- 59:30Our content ranges from true beginners to deeply advanced topics like memory and async.
- 59:35And best of all, there's not a subscription in sight.
- 59:38Check it out for yourself at training.talkpython.fm.
- 59:41Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
- 59:46We should be right at the top.
- 59:47You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
- 59:57We're live streaming most of our recordings these days.
- 59:59If 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.
- 1:00:08This is your host, Michael Kennedy.
- 1:00:09Thanks so much for listening.
- 1:00:10I really appreciate it.
- 1:00:12Now get out there and write some Python code.