Skip to main content
marimo provides flexible configuration options to customize your development environment. Configuration can be applied globally, per-project, or per-notebook, giving you fine-grained control over editor behavior, runtime settings, code completion, and more.

Configuration Hierarchy

marimo merges configuration from multiple sources in order of precedence:
  1. Script metadata (highest priority) - Embedded in notebook files
  2. Project configuration - pyproject.toml in project directory
  3. User configuration (lowest priority) - ~/.config/marimo/marimo.toml
Settings from higher-priority sources override those from lower-priority sources. Settings configured in pyproject.toml or script metadata cannot be changed through the marimo UI.

User Configuration

User configuration applies globally to all marimo notebooks and is stored in ~/.config/marimo/marimo.toml (or $XDG_CONFIG_HOME/marimo/marimo.toml).

Locating Your Config File

Find your user configuration file:

Creating and Editing

marimo creates a config file automatically on first run. You can edit it through: Via UI (Recommended):
  1. Open any notebook: marimo edit
  2. Click settings icon (⚙️) in top-right
  3. Navigate to different configuration tabs
  4. Changes save automatically
Via Text Editor:

Configuration File Format

The marimo.toml file uses TOML format:
marimo.toml

Project Configuration

Project configuration is stored in pyproject.toml and applies to all notebooks in the project directory (and subdirectories). This is ideal for team settings and ensuring consistent behavior across a codebase.

Setup

Create or edit pyproject.toml in your project root:
pyproject.toml

Project-Specific Paths

marimo resolves relative paths in pyproject.toml relative to the file’s location:
pyproject.toml

Configuration Discovery

marimo searches for pyproject.toml by walking up the directory tree from the notebook location:

Script Metadata Configuration

Embed configuration directly in notebook files using PEP 723 script metadata. This has the highest precedence and travels with the notebook.

Adding Script Metadata

Add a special comment block at the top of your notebook:
notebook.py
This configuration applies only to this specific notebook and overrides user and project settings.
Use script metadata for:
  • Notebook-specific display preferences (theme, width)
  • Disabling auto-instantiate for expensive notebooks
  • Lazy execution for interactive analysis
  • Configuration that should travel with the notebook

Configuration Categories

Completion

Control code completion and AI copilots:
See Code Completion for details.

Display

Customize editor appearance:

Formatting

Code formatting options:
marimo uses Ruff for formatting. Install with:

Keymap

Keyboard shortcuts and vim mode:
See Keyboard Shortcuts for all available actions.

Runtime

Control notebook execution behavior:
Key settings explained:
  • auto_instantiate: If false, cells don’t run automatically when opening a notebook (useful for expensive computations)
  • on_cell_change: How dependent cells react when an ancestor changes
    • "autorun": Automatically re-run dependent cells
    • "lazy": Mark dependent cells as stale without running
  • auto_reload: Automatically reload modified Python modules
    • "off": No auto-reloading
    • "lazy": Mark importing cells as stale when modules change
    • "autorun": Auto-run importing cells when modules change
See Runtime Configuration for details.

Save

Autosave and formatting:

Package Management

Package manager preference:
See Package Management for details.

Server

Server behavior:

AI Configuration

AI assistance and copilots:
See AI Completion and LLM Providers for details.

Language Servers

Configure LSP servers for enhanced code intelligence:
See Language Server Protocol for details.

Diagnostics

Error checking and linting:

Snippets

Code snippets configuration:
See Snippets for details.

Experimental Features

Enable preview features:
Experimental features may change or be removed in future versions.

Environment Variables

marimo supports environment variables for advanced configuration: Set environment variables in your shell or .env file:
Or load from .env files:
pyproject.toml
Prefer configuring output_max_bytes and std_stream_max_bytes in pyproject.toml rather than environment variables for better reproducibility.

Configuration Examples

Team Data Science Setup

pyproject.toml

Individual Developer Setup

~/.config/marimo/marimo.toml

Expensive Computation Notebook

expensive_analysis.py

Troubleshooting

Check configuration precedence:
  1. Script metadata overrides everything
  2. Project pyproject.toml overrides user config
  3. User marimo.toml is the base
Verify which config is active:
Look for the config file path and current settings.
If settings are grayed out in the UI, they’re overridden in pyproject.toml or script metadata. Edit those files directly:
Ensure vim preset is set:
If using a vimrc file, ensure the path is correct:
Verify pythonpath is set correctly:
pyproject.toml
Test in a cell:

Best Practices

Do commit:
  • pyproject.toml - Shared project settings
  • Script metadata in notebooks - Notebook-specific config
Don’t commit:
  • ~/.config/marimo/marimo.toml - Personal settings
  • API keys (use environment variables instead)
Use pyproject.toml to ensure consistent behavior:
pyproject.toml
Commit this file so all team members use the same settings.
Don’t hardcode API keys in config files:
.env
pyproject.toml
Add .env to .gitignore.