marimo-toml-editor: The Best Way to Edit TOML in Marimo Notebooks

If you’ve been using Marimo, you already know it’s a game-changer for Python notebooks. Marimo notebooks are reactive, reproducible, and stored as pure Python scripts. They make data science, prototyping, and building interactive tools a breeze.

However, when working on complex projects or interactive tools, managing configuration is a common hurdle. Often, you need to tweak parameters, adjust settings, or manage metadata. And what’s the modern standard for human-readable configuration? TOML (Tom’s Obvious, Minimal Language).

Yesterday, I published marimo-toml-editor, a new Python package designed to bridge the gap between reactive Marimo notebooks and TOML configurations. Here’s why I built it and why I think it’s the best tool for the job.

The Problem

Before marimo-toml-editor, managing TOML configuration inside a notebook usually meant one of two things:

  1. Hardcoding a Python dictionary and losing the standard TOML format.
  2. Using a clunky multiline string cell where syntax errors are easy to make and hard to spot until execution time.

Neither of these solutions felt right for the highly polished, interactive experience that Marimo provides. We needed an actual, interactive editor that natively plugged into Marimo’s reactive dataflow.

Enter marimo-toml-editor

marimo-toml-editor is a custom UI element built specifically for Marimo. It provides a sleek, interactive editor for TOML data directly within your notebook cell.

Why is it the best?

  1. True Reactivity: Because it leverages Marimo’s reactive UI state, any change you make in the editor is immediately propagated to the rest of your notebook. Downstream cells tied to your configuration will automatically re-run with the updated TOML data.
  2. First-Class User Experience: No more dealing with raw strings and escaping quotes. You get a dedicated interface to edit your TOML, making your notebooks feel more like fully-fledged applications.
  3. Seamless Integration: It’s designed to behave exactly like native Marimo UI elements, meaning you can easily instantiate it, access its .value, and parse it into a Python dictionary using the standard library’s tomllib (or tomli for older Python versions).
  4. Anywidget Powered: Built on top of the robust Anywidget ecosystem, ensuring high performance and seamless bridging between frontend UI and backend Python state.

Getting Started

Getting started is as simple as installing the package:

pip install marimo-toml-editor

Once installed, you can drop it right into your Marimo notebooks:

import marimo as mo
from marimo_toml_editor import TomlEditor

# Initialize the editor with some default TOML content
default_content = """
[database]
server = "192.168.1.1"
ports = [ 8000, 8001, 8002 ]
connection_max = 5000
enabled = true
"""

# Render the widget
editor = mo.ui.anywidget(TomlEditor(initial_content=default_content))
editor

In another cell, you can reactively access the edited content:

import tomllib

# This cell will automatically re-run whenever the editor's content changes!
config_dict = tomllib.loads(editor.value)
mo.md(f"**Current Port:** {config_dict['database']['ports'][0]}")

Conclusion

Building interactive data tools has never been easier thanks to Marimo, and with marimo-toml-editor, handling configuration files is finally a first-class citizen in that ecosystem.

Give it a try during your next project, and let me know what you think! You can find the package on PyPI.

© 2025 Javier Rodríguez Martínez. All Rights Reserved.