Utility functions used in marimo.
Note
This is a community led effort and not actively prioritized by the core marimo team.
pip install moutils
or with uv:
uv add moutils
Widget for interacting with URL hash. Allows you to get and set the hash portion of the URL.
Widget for interacting with URL path. Allows you to get and set the current URL path.
Widget for querying DOM elements. Use CSS selectors to find and interact with elements on the page.
Widget for managing browser cookies. Get, set, and monitor browser cookies.
Widget for interacting with browser storage (local/session). Access and manipulate data in browser's localStorage or sessionStorage.
Widget for creating a slot that can contain HTML and handle DOM events. Supports a wide range of events:
- Mouse events (click, hover, etc.)
- Keyboard events
- Form events
- Drag and drop
- Touch events
- Pointer events
- Scroll events
- Clipboard events
- Animation and transition events
Widget for copying text to clipboard. Provides a button to copy text and shows success feedback.
Interactive shell command widget for running terminal commands in notebooks. Features:
- Real-time output streaming
- Cross-platform support (Windows, macOS, Linux)
- Working directory specification
- Asynchronous execution
- Error handling and status reporting
Use the convenience function shell()
or the ShellWidget
class directly:
from moutils import shell
# Simple command
shell("ls -la")
# With working directory
shell("npm install", working_directory="./frontend")
We use uv for development.
Specific notebook
uv run marimo edit notebooks/example.py
Workspace
uv run --active marimo edit --port 2718
uv tool install pre-commit
pre-commit
To run all tests (including environment detection and OAuth device flow):
pytest -v tests/