Sign Up to Our Newsletter

Be the first to know the latest tech updates

[mc4wp_form id=195]

Why I’m Making the Switch to marimo Notebooks

Why I’m Making the Switch to marimo Notebooks


of using Jupyter Lab, I have moved most of my work to marimo notebooks, a new kind of Python notebook that addresses many long-standing issues with traditional ones. This article covers the reasons behind my transition and how marimo fits naturally into my current workflow, with full gratitude to Project Jupyter for building the notebook ecosystem that shaped data science, research and education.

A bit of background

I have spent years inside notebooks. For a long time, my setup was a mix of Jupyter Notebooks/Lab for local experiments and Google Colab for cloud or GPU work, thanks to their free tier option. I have even authored many blogs on making the most out of these notebooks, where I have shared tips to go beyond the normal way of using them.

Having said that, there have been certain issues with these traditional notebooks, the biggest being reactivity (or rather, the lack of it). Hidden state, out-of-order execution, and manual reruns were some of my pain points with these notebooks.

That changed when I discovered marimo, an open-source alternative for Jupyter notebooks wherein you can run cells, perform computations, and create plots just as you would in Jupyter. But underneath, it works very differently and fixes many long-standing issues. The key difference is that a marimo notebook is just a Python file, making it both a better notebook and a better coding environment for anyone who uses Python. In this article, I share ten reasons behind my switch and why working with notebooks has been much smoother for me since moving to marimo.

If you want to follow along, install marimo as shown below. This command launches the marimo editor and opens the notebook in sandbox mode, which works like a lightweight virtual environment that keeps your notebook isolated from the rest of your system. You can also use marimo.new to start a new notebook in the online playground. For detailed instructions, refer to the documentation.

pip install marimo
marimo edit --sandbox notebook.py

1. Reactivity that finally fixes the hidden state issues

Traditional notebooks are not reactive. This means that if I change something in one cell, nothing else updates on its own. I often end up re-running them just to keep the outputs consistent. For instance, consider the Jupyter Notebook below where on the left I define two variables, a and b, add them together to get a third variable c, and then display the value of c, which is 30.

In a traditional notebook, changing the value of a does not update c automatically. The output stays stale until you rerun the cells yourself, which is the hidden state problem in action | Image by Author

Now, if I were to change a to 20 as shown on the right , c would still show 30 unless I re-ran the cell. That mismatch between code and output is the classic hidden state problem.

Marimo fixes this with reactive execution, where every cell is part of a dependency graph (DAG). Changes in one cell automatically trigger updates in dependent cells. So, when a changes, marimo re-evaluates any dependent cells. See how c updates automatically when the value of a is changed.

In marimo , changing a updates c instantly because the notebook is reactive and keeps all cells in sync | Image by Author

This keeps my code and outputs perfectly in sync and it means I can share my notebooks with others without worrying about the order in which they execute.

But should every cell update automatically? Not always. Some cells are expensive to run, like those involving ML training or heavy data processing. The good news is that marimo supports lazy execution, which lets you turn off auto-updates and trigger such cells only when needed.

2. Cell order no longer breaks my workflow

Since marimo notebooks execute cells based on variable relationships and not their order on the page, this gives me the freedom to organize my code in a way that makes sense to me. For instance, I can place all my imports and helper functions at the bottom to keep the workspace clean.

This also opens up some fun use cases. I have used this to create small auto-graded quizzes where the answer key sits at the bottom of the notebook. The quiz still works fine because the cell order does not matter, and the answers are not immediately visible to the person taking the quiz. (And yes, marimo comes with a dark mode too 😃.)

A quick demo of an auto-graded quiz made possible because cell order does not matter. | Image by Author

3. It’s basically a Python File under the hood

Since every marimo notebook is stored as a pure Python file, it solves my long-standing issue with versioning in Git. I can finally track changes cleanly without dealing with messy JSON diffs. The notebook also becomes far more flexible. I can reuse it as a script, run it from the command line, or even turn it into a small interactive app without changing anything.

Below, the right side shows the marimo notebook view, while the left side shows the same notebook opened as a normal Python file in an editor.

Same notebook, two views : the Python source on the left and its interactive marimo notebook on the right | Image by Author

4. I can easily turn my Notebooks into apps

Turning a marimo notebook into an interactive app is also easy. I can switch between Edit Mode and App View with a single click, and I never have to rewrite my code or add anything extra.

Here is an example notebook which converts temperatures from Celsius to Fahrenheit. The same notebook can be viewed in App Mode using the default vertical layout.

Toggling between Edit Mode and App View with a single click | Image by Author

This feature is especially useful for creating interactive blogs, tutorials, and educational walkthroughs for libraries. If you’ve ever read AI Explorables, you know the feeling of engaging with content rather than just reading it. Marimo gives a similar feel and the Grid Layout makes it even better since I can drag and drop outputs to arrange the app the way I want.

Using the Grid Layout to customize the app display in marimo | Image by Author

5. Efficient Package Manager, so no more dependency headaches

Marimo comes with a built-in package manager that lets me install missing libraries right from the notebook. If a module is unavailable, marimo shows a small prompt, and I can install it with a click. This removes the usual back-and-forth with terminals.

built-in package manager in marimo | Image by Author

Marimo also handles reproducibility for me. When I run a notebook with the --sandbox flag, it tracks all packages and their exact versions and saves them inside the notebook file as a top-level comment. There is no need for a separate requirements.txt file because the notebook already carries everything it needs.

Dependency metadata lives inside the notebook itself, and shows up clearly when you open the marimo file as a normal Python script. | Image by Author

6. Built-in utilities for working with DataFrames.

If you spend a lot of time exploring data, this is one of those features that immediately feels like a godsend. When you display a dataFrame in marimo, the default view is fully interactive and comes with several helpful tools right out of the box, like scrolling, pagination, automatic histograms for numeric columns, and simple sorting and filtering from the column headers. This speeds up the EDA process for me, as visual exploration often gives better insights.

Interactive dataframe view in marimo with built-in sorting, filtering, and histograms | Image by Auhtor

Marimo also lets me turn a DataFrame into an interactive input element. Using mo.ui.table,I can select rows and use those selections in downstream computations. The selections update reactively, which means the rest of my notebook updates automatically too.

Interactive row selection with mo.ui.table, feeding straight into downstream cells | Image by Author

If I want to share a notebook with a business stakeholder, marimo includes a UI dataframe editor that lets them drag and drop aggregations and transformations without writing any code. It even generates the equivalent Python code for every step.

Marimo’s UI dataframe editor lets business users explore data without writing code | Image by AUthor

And wait, that’s not all. There’s also a Data Explorer utility that lets me build quick visualizations directly from the DataFrame.

Using the Data Explorer to pick columns and generate instant visuals | Image by Author

All of this makes early-stage data exploration much faster. Instead of juggling libraries or writing boilerplate code just to understand a dataset, I can start analyzing and visualizing right away inside the notebook.

7. See the documentation as you type

One of the most underrated features of marimo notebooks for me has been the Live Docs panel. I can see function docstrings, parameters, and examples without calling help utilities.

The panel is also interactive, so I can scroll through long docstrings, check examples, and copy snippets into my notebook. If the docstring has formatted examples, marimo detects them and lets me copy them straight into a new cell, which has been very handy while learning new libraries.

Live Docs in action, showing documentation in real time as I type | Image by Author

8. SQL Inside the Notebook

Marimo has great support for SQL. I can stay in one notebook and mix SQL and Python in a very natural way. I can write a SQL query inside a SQL cell, run it, and get the same clean table view that marimo gives for DataFrames.

I can also run SQL on local files through DuckDB. A simple select * from "file.csv" just works. If I want to connect to a real database, I can do that from the side panel. Marimo lets me add different data sources, and once added, the tables show up directly in the notebook.

Running SQL on DataFrames and local files right inside Marimo without leaving the notebook | Image by Author

9. Molab: marimo notebooks in the cloud

Molab is for marimo notebooks, what Google Colab is for Jupyter notebooks. You get all the goodness of marimo notebooks in the cloud. You can open Molab at molab.marimo.io, create new notebooks, or open the ones you made earlier. It is a great option when I want to spin up a notebook fast or avoid running things on my machine. Many popular Python packages are pre-installed, notebooks have persistent storage, and I can share, download, or upload them easily.

molab: marimo notebooks in the cloud | Image by Author

Another neat feature is the GitHub integration. You can go to the Molab URL and replace molab.marimo.io/notebooks with molab.marimo.io/github and it will let you open any notebook, Jupyter or marimo, that is hosted on GitHub in Molab. However, there is no GPU support for now, like in Colab, but I’m sure that is something that the team will be working on.

10. Customizable LLMs integration

Marimo also has some really useful AI-assisted coding features built in, which have been very helpful for me. To be honest, Jupyter also has a JupyterLab extension for AI features called JupyterAI (and yes, I have written about that too), but having AI support built into marimo removes a lot of the friction for me.

I use AI in marimo mainly for two things. The first is generating new notebooks when I want to try a new library or make a quick demo. It saves me time since I do not have to hunt for toy datasets or set up everything from scratch.

Generating entire notebooks via AI in marimo | Image by Author

The second is refactoring and debugging. Marimo’s AI assistant has the full context of my notebook, so it can read my code and help me fix or clean it up right inside the notebook.

AI assistant in marimo | Image by Author

I also like that I can choose different models for chat and for editing, and set my own rules for how I want code to be written. And if I want to avoid proprietary models, Ollama works fine as a provider too.

Conclusion

I am not connected to the marimo team and this is not a paid post, but my experience from using it in real projects. This is a long read because I wanted to share how marimo has made my notebook work smoother in practice. I am only calling out the parts that helped me the most. The docs go much deeper and are the best place to explore everything marimo has to offer.



Source link

Parul Pandey

About Author

TechToday Logo

Your go-to destination for the latest in tech, AI breakthroughs, industry trends, and expert insights.

Get Latest Updates and big deals

Our expertise, as well as our passion for web design, sets us apart from other agencies.

Digitally Interactive  Copyright 2022-25 All Rights Reserved.