mr_munshine
mr_munshine9mo ago

👋. Howdy. Is there any interest in

👋. Howdy. Is there any interest in having a marimo function/api to refresh/re-render the current cell? I know reactivity is builtin, but, as I am starting to build more complex apps, I find myself moving more and more code to external python files, leaving marimo as a pure renderer. Thus the state is managed externally to marimo (in the pure python code). So, I would like a way to programatically re-render the current cell. Does that seem doable?
12 Replies
mr_munshine
mr_munshineOP9mo ago
🧵 My team has started to adopt Marimo, and I have some really complex things I'd like to do with it. Frankly, it is awesome as a simple "app" builder, which moves a bit away from the typical notebook
Akshay
Akshay9mo ago
I think today you may be able to accomplish something like this using mo.state() — state objects would be created in a cell, but the setters could be passed to functions that could call them to trigger rerenders
mr_munshine
mr_munshineOP9mo ago
I somewhat use that already, but you can only trigger other cells Not the current cell
Akshay
Akshay9mo ago
Mm right good point
mr_munshine
mr_munshineOP9mo ago
So I have this complex routine where I create circular dependencies to accomplish a single cell re-render But it's ... clunky To give you some insights, my team has really taken a liking to marimo. We're starting to convert some of our scripts that do various things to marimo, because it gives you this UI feedback that is really nice But what we're building is really multi-step processes, where UI feedback changes constantly, and depending on various choices you make, you walk different paths of UI amongst the realm of possible This requires more advanced management than the simple concept of cells So, I'm moving a lot of that to python, and my cells just become "render_stepN" But even that piece may be a complex UI with many components, and many ways to interwact with it, and may need to refresh itself based on actions Lol. Yeah, so.. Marimo is awesome, that's the cool part. But now I want more power he he In a normal world, I would be building just a web app. But then I would have to build a lot of the UI, link a lot of interactions, etc, that I get for free with marimo probably not the intended use, but hey, it works kinda entering "retool" kind of thing territory
Akshay
Akshay9mo ago
Mm very interesting. Like you mentioned it sounds like the stuff you’re working on is less like “notebooking”, and more like retool. It’s cool that it works for the most part! Would the simple primitive “re-run the current cell” solve your problem?
mr_munshine
mr_munshineOP9mo ago
mostly yes. at least for the moment 😆 Until I get bigger ambitions
Akshay
Akshay9mo ago
Haha makes sense. Would you be open to chatting over a call sometime? I’d like to get a better sense of the kinds of tools you’re building. If you’re up for it my calendar is at https://calendly.com/akshay-marimo
Calendly
Akshay Agrawal
Welcome to my scheduling page. Please follow the instructions to add an event to my calendar.
Akshay
Akshay9mo ago
It would be awesome to support your use case — just want to see how to do it while also still being true to marimo’s goal of being a notebook
mr_munshine
mr_munshineOP9mo ago
Sure. I'll pick a spot.
Akshay
Akshay9mo ago
Thanks, looking forward to it! To answer your original question though, yes I think it should be possible to provide a “re-run cell” primitive
mr_munshine
mr_munshineOP9mo ago
Alright. Booked. Talk soon!