Configuration Hierarchy
marimo merges configuration from multiple sources in order of precedence:- Script metadata (highest priority) - Embedded in notebook files
- Project configuration -
pyproject.tomlin project directory - 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):- Open any notebook:
marimo edit - Click settings icon (⚙️) in top-right
- Navigate to different configuration tabs
- Changes save automatically
Configuration File Format
Themarimo.toml file uses TOML format:
marimo.toml
Project Configuration
Project configuration is stored inpyproject.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 editpyproject.toml in your project root:
pyproject.toml
Project-Specific Paths
marimo resolves relative paths inpyproject.toml relative to the file’s location:
pyproject.toml
Configuration Discovery
marimo searches forpyproject.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
Configuration Categories
Completion
Control code completion and AI copilots:Display
Customize editor appearance:Formatting
Code formatting options:Keymap
Keyboard shortcuts and vim mode:Runtime
Control notebook execution behavior:auto_instantiate: Iffalse, 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
Save
Autosave and formatting:Package Management
Package manager preference:Server
Server behavior:AI Configuration
AI assistance and copilots:Language Servers
Configure LSP servers for enhanced code intelligence:Diagnostics
Error checking and linting:Snippets
Code snippets configuration: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:
.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
Settings not taking effect
Settings not taking effect
Check configuration precedence:Look for the config file path and current settings.
- Script metadata overrides everything
- Project
pyproject.tomloverrides user config - User
marimo.tomlis the base
Can't change settings in UI
Can't change settings in UI
If settings are grayed out in the UI, they’re overridden in
pyproject.toml or script metadata. Edit those files directly:Vim mode not working
Vim mode not working
Ensure vim preset is set:If using a vimrc file, ensure the path is correct:
Python path not working
Python path not working
Verify Test in a cell:
pythonpath is set correctly:pyproject.toml
Best Practices
✅ Version control configuration
✅ Version control configuration
Do commit:
pyproject.toml- Shared project settings- Script metadata in notebooks - Notebook-specific config
~/.config/marimo/marimo.toml- Personal settings- API keys (use environment variables instead)
✅ Use environment variables for secrets
✅ Use environment variables for secrets
Don’t hardcode API keys in config files:Add
.env
pyproject.toml
.env to .gitignore.Related Documentation
- Runtime Configuration - Detailed runtime settings
- LLM Providers - AI provider configuration
- Keyboard Shortcuts - Customizing keybindings
- Code Completion - Completion configuration
- Language Server Protocol - LSP configuration