of utilizing Jupyter Lab, I’ve moved most of my work to marimo notebooks, a brand new sort of Python pocket book that addresses many long-standing points with conventional ones. This text covers the explanations behind my transition and the way marimo matches naturally into my present workflow, with full gratitude to Undertaking Jupyter for constructing the pocket book ecosystem that formed knowledge science, analysis and training.
A little bit of background
I’ve spent years inside notebooks. For a very long time, my setup was a mixture of Jupyter Notebooks/Lab for native experiments and Google Colab for cloud or GPU work, due to their free tier possibility. I’ve even authored many blogs on making probably the most out of those notebooks, the place I’ve shared tricks to transcend the traditional means of utilizing them.
Having mentioned that, there have been sure points with these conventional notebooks, the largest being reactivity (or quite, the shortage of it). Hidden state, out-of-order execution, and handbook reruns have been a few of my ache factors with these notebooks.
That modified once I found marimo, an open-source various for Jupyter notebooks whereby you possibly can run cells, carry out computations, and create plots simply as you’ll in Jupyter. However beneath, it really works very in a different way and fixes many long-standing points. The important thing distinction is {that a} marimo pocket book is only a Python file, making it each a greater pocket book and a greater coding atmosphere for anybody who makes use of Python. On this article, I share ten causes behind my swap and why working with notebooks has been a lot smoother for me since shifting to marimo.
If you wish to observe alongside, set up marimo as proven under. This command launches the marimo editor and opens the pocket book in sandbox mode, which works like a light-weight digital atmosphere that retains your pocket book remoted from the remainder of your system. It’s also possible to use
marimo.newto begin a brand new pocket book within the on-line playground. For detailed directions, consult with the documentation.
pip set up marimo
marimo edit --sandbox pocket book.py
1. Reactivity that lastly fixes the hidden state points
Conventional notebooks will not be reactive. Because of this if I alter one thing in a single cell, nothing else updates by itself. I usually find yourself re-running them simply to maintain the outputs constant. For example, think about the Jupyter Pocket book under the place on the left I outline two variables, a and b, add them collectively to get a 3rd variable c, after which show the worth of c, which is 30.
Now, if I have been to alter a to twenty as proven on the fitting , c would nonetheless present 30 until I re-ran the cell. That mismatch between code and output is the basic hidden state downside.
Marimo fixes this with reactive execution, the place each cell is a part of a dependency graph (DAG). Adjustments in a single cell mechanically set off updates in dependent cells. So, when a modifications, marimo re-evaluates any dependent cells. See how c updates mechanically when the worth of a is modified.

This retains my code and outputs completely in sync and it means I can share my notebooks with others with out worrying in regards to the order during which they execute.
However ought to each cell replace mechanically? Not all the time. Some cells are costly to run, like these involving ML coaching or heavy knowledge processing. The excellent news is that marimo helps lazy execution, which helps you to flip off auto-updates and set off such cells solely when wanted.
2. Cell order not breaks my workflow
Since marimo notebooks execute cells primarily based on variable relationships and never their order on the web page, this provides me the liberty to arrange my code in a means that is sensible to me. For example, I can place all my imports and helper capabilities on the backside to maintain the workspace clear.
This additionally opens up some enjoyable use circumstances. I’ve used this to create small auto-graded quizzes the place the reply key sits on the backside of the pocket book. The quiz nonetheless works high-quality as a result of the cell order doesn’t matter, and the solutions will not be instantly seen to the particular person taking the quiz. (And sure, marimo comes with a darkish mode too 😃.)

3. It’s mainly a Python File underneath the hood
Since each marimo pocket book is saved as a pure Python file, it solves my long-standing challenge with versioning in Git. I can lastly monitor modifications cleanly with out coping with messy JSON diffs. The pocket book additionally turns into much more versatile. I can reuse it as a script, run it from the command line, and even flip it right into a small interactive app with out altering something.
Under, the fitting facet exhibits the marimo pocket book view, whereas the left facet exhibits the identical pocket book opened as a traditional Python file in an editor.

4. I can simply flip my Notebooks into apps
Turning a marimo pocket book into an interactive app can also be simple. I can swap between Edit Mode and App View with a single click on, and I by no means need to rewrite my code or add something additional.
Right here is an instance pocket book which converts temperatures from Celsius to Fahrenheit. The identical pocket book could be seen in App Mode utilizing the default vertical format.

This characteristic is very helpful for creating interactive blogs, tutorials, and academic walkthroughs for libraries. If you happen to’ve ever learn AI Explorables, you already know the sensation of partaking with content material quite than simply studying it. Marimo offers an analogous really feel and the Grid Format makes it even higher since I can drag and drop outputs to rearrange the app the best way I would like.

5. Environment friendly Bundle Supervisor, so no extra dependency complications
Marimo comes with a built-in package deal supervisor that lets me set up lacking libraries proper from the pocket book. If a module is unavailable, marimo exhibits a small immediate, and I can set up it with a click on. This removes the same old back-and-forth with terminals.

Marimo additionally handles reproducibility for me. After I run a pocket book with the --sandbox flag, it tracks all packages and their precise variations and saves them contained in the pocket book file as a top-level remark. There isn’t a want for a separate necessities.txt file as a result of the pocket book already carries the whole lot it wants.

6. Constructed-in utilities for working with DataFrames.
If you happen to spend loads of time exploring knowledge, that is a kind of options that instantly appears like a godsend. Once you show a dataFrame in marimo, the default view is absolutely interactive and comes with a number of useful instruments proper out of the field, like scrolling, pagination, computerized histograms for numeric columns, and easy sorting and filtering from the column headers. This hurries up the EDA course of for me, as visible exploration usually offers higher insights.

Marimo additionally lets me flip a DataFrame into an interactive enter component. Utilizing mo.ui.desk,I can choose rows and use these picks in downstream computations. The picks replace reactively, which suggests the remainder of my pocket book updates mechanically too.

If I wish to share a pocket book with a enterprise stakeholder, marimo features a UI dataframe editor that lets them drag and drop aggregations and transformations with out writing any code. It even generates the equal Python code for each step.

And wait, that’s not all. There’s additionally a Information Explorer utility that lets me construct fast visualizations instantly from the DataFrame.

All of this makes early-stage knowledge exploration a lot quicker. As an alternative of juggling libraries or writing boilerplate code simply to grasp a dataset, I can begin analyzing and visualizing straight away contained in the pocket book.
7. See the documentation as you sort
Some of the underrated options of marimo notebooks for me has been the Stay Docs panel. I can see perform docstrings, parameters, and examples with out calling assist utilities.
The panel can also be interactive, so I can scroll by means of lengthy docstrings, examine examples, and replica snippets into my pocket book. If the docstring has formatted examples, marimo detects them and lets me copy them straight into a brand new cell, which has been very useful whereas studying new libraries.

8. SQL Contained in the Pocket book
Marimo has nice help for SQL. I can keep in a single pocket book and blend SQL and Python in a really pure means. I can write a SQL question inside a SQL cell, run it, and get the identical clear desk view that marimo offers for DataFrames.
I may run SQL on native information by means of DuckDB. A easy choose * from "file.csv" simply works. If I wish to connect with an actual database, I can try this from the facet panel. Marimo lets me add totally different knowledge sources, and as soon as added, the tables present up instantly within the pocket book.

9. Molab: marimo notebooks within the cloud
Molab is for marimo notebooks, what Google Colab is for Jupyter notebooks. You get all of the goodness of marimo notebooks within the cloud. You possibly can open Molab at molab.marimo.io, create new notebooks, or open those you made earlier. It’s a nice possibility once I wish to spin up a pocket book quick or keep away from operating issues on my machine. Many well-liked Python packages are pre-installed, notebooks have persistent storage, and I can share, obtain, or add them simply.

One other neat characteristic is the GitHub integration. You possibly can go to the Molab URL and exchange molab.marimo.io/notebooks with molab.marimo.io/github and it’ll allow you to open any pocket book, Jupyter or marimo, that’s hosted on GitHub in Molab. Nevertheless, there is no such thing as a GPU help for now, like in Colab, however I’m positive that’s one thing that the staff can be engaged on.
10. Customizable LLMs integration
Marimo additionally has some actually helpful AI-assisted coding options inbuilt, which have been very useful for me. To be sincere, Jupyter additionally has a JupyterLab extension for AI options referred to as JupyterAI (and sure, I have written about that too), however having AI help constructed into marimo removes loads of the friction for me.
I take advantage of AI in marimo primarily for 2 issues. The primary is producing new notebooks once I wish to attempt a brand new library or make a fast demo. It saves me time since I should not have to hunt for toy datasets or arrange the whole lot from scratch.

The second is refactoring and debugging. Marimo’s AI assistant has the total context of my pocket book, so it could possibly learn my code and assist me repair or clear it up proper contained in the pocket book.

I additionally like that I can select totally different fashions for chat and for modifying, and set my very own guidelines for a way I would like code to be written. And if I wish to keep away from proprietary fashions, Ollama works high-quality as a supplier too.
Conclusion
I’m not related to the marimo staff and this isn’t a paid put up, however my expertise from utilizing it in actual initiatives. This can be a lengthy learn as a result of I wished to share how marimo has made my pocket book work smoother in apply. I’m solely calling out the components that helped me probably the most. The docs go a lot deeper and are the perfect place to discover the whole lot marimo has to supply.

