marimo

repository·main·Indexed 12 days ago

https://github.com/marimo-team/marimo

A reactive Python notebook environment that is reproducible, git-friendly, and deployable as standalone web apps or scripts. It features automatic dependency tracking to solve the 'hidden state' problem, a reactive UI component library including mo.ui.chat for chatbots, and integration capabilities with frameworks like FastAPI, FastHTML, and Flask.

Tokens
165.4K
Snippets
635
Records
868
Agent score
94%

What's inside marimo

  1. Overview of Charting Components in marimo

    main

    The marimo charting system uses a modular architecture to maintain a consistent look and feel. The system is divided into three main categories of components:

    1. Layouts: Thin wrappers around @ui components that provide consistent styling and behavior (e.g., TabContainer, AccordionConfigs).
    2. Form Fields: Specialized form fields that wrap react-hook-form components for use within chart configuration forms (e.g., ColumnSelector, AggregationSelect).
    3. Chart Items: High-level components used to build the actual charts by grouping common form fields and layouts together (e.g., XAxis, YAxis, ChartTypeSelect).
  2. Overview of marimo data features

    main

    marimo provides several specialized features for data manipulation and exploration:

    • SQL Cells: Use SQL syntax to query dataframes, databases, CSV files, and other data sources directly within a cell.
    • No-code Dataframe Transformations: Use interactive tools to filter, search, and transform dataframes without writing manual Python code.
    • Interactive Plotting: Create plots where user selections (e.g., brushing or clicking) are automatically sent back to your Python environment as variables.
    • Remote Storage Browsing: Connect to and browse files from cloud storage providers like Amazon S3, Google Cloud Storage (GCS), and Azure.
  3. What is marimo?

    main

    marimo is a reactive Python notebook environment. Unlike traditional notebooks (like Jupyter), marimo:

    • Is Reactive: When you update a cell, marimo automatically re-runs dependent cells or marks them as outdated.
    • Is Git-friendly: Notebooks are stored as pure .py files.
    • Has No Hidden State: Deleting a cell removes its variables from memory, preventing accidental state dependencies.
    • Supports Interactivity: UI elements like sliders, dropdowns, and chat interfaces are natively linked to Python variables without requiring manual callbacks.
    • Includes SQL Support: You can run SQL queries against dataframes, databases, or CSVs using an integrated engine.
    • Is Executable: Notebooks can be run as standalone Python scripts or deployed as interactive web applications.
  4. Deploy marimo as a notebook server or a web app

    main

    marimo supports two primary deployment modes:

    1. Notebook Servers (marimo edit): Used for creating, running, and editing notebooks on a remote instance. This mode is suitable for collaborative environments or remote development.
    2. Apps (marimo run): Used to serve notebooks as read-only web applications. This mode is intended for end-users to consume your work without being able to edit the source code.

    For managed infrastructure, you can use molab for free cloud-hosted notebooks, or use pre-built containers.

  5. SQL Utilities: Linting, Formatting, and Validation

    main

    marimo provides several utilities for working with SQL cells:

    • SQL Linter: Provides autocompletion and error highlighting. Can be disabled in pyproject.toml via sql_linter = false or in the editor settings.
    • SQL Formatting: Click the paint roller icon at the bottom right of a SQL cell to format your code.
    • Validate Mode (DuckDB only): For In-Memory DuckDB, marimo offers a 'Validate' mode that runs a debounced query in EXPLAIN mode to return parsed errors as you type.
  6. Explore marimo features and documentation

    main

    marimo provides a reactive programming environment for Python. You can explore its capabilities through the following resources:

  7. Core features of marimo

    main

    marimo provides several key capabilities for data science and application development:

    • Git-friendly: Notebooks are stored as pure .py files.
    • SQL Support: Build SQL queries that depend on Python variables; results are returned as Python dataframes.
    • Interactive UI: Bind sliders, tables, and plots to Python variables without writing manual callbacks.
    • AI-Native: Built-in AI assistants for code completion and specialized data-aware AI agents (e.g., marimo pair).
    • Package Management: Built-in support for installing packages on import and serializing requirements into the notebook file.
    • Deterministic Execution: Cells are executed based on variable references rather than their visual position on the page.
  8. What are @marimo-team/smart-cells?

    main
    @marimo-team/smart-cells is a utility package designed to parse "smart cells" (such as Markdown and SQL) to and from Python code. This allows for seamless integration of non-Python languages and formats within a marimo notebook environment by treating them as specialized cell types that can be serialized and deserialized.
  9. Explore marimo usage examples and patterns

    main

    marimo provides a wide range of bite-sized examples categorized by functionality to help you build reactive notebooks. Key categories include:

    • Cell Execution: Managing async functions, caching computations (memory or persistent), debugging, and running notebooks as scripts.
    • Visual Outputs: Displaying markdown (including Mermaid diagrams and dynamic Python values), plots (Altair, Plotly, Matplotlib), media, and console outputs.
    • Data Handling: Interactive dataframe viewers, editable dataframes, SQL querying (DuckDB, SQLite, Postgres), and reactive plotting.
    • UI & Layouts: Using progress bars, spinners, accordions, tabs, and stacking (horizontal/vertical).
    • Input Elements: A library of interactive elements ranging from basic (sliders, dropdowns, checkboxes) to composite (forms, arrays, dictionaries).

    For inspiration, you can also visit the marimo public gallery.

  10. Embed media in marimo outputs

    main

    marimo provides a suite of functions to embed various media types directly into your notebook outputs. Most of these functions accept a URL (including data URLs), a path to a local file, or a file-like object as an argument.

    Available media functions:

    • marimo.image: Display images.
    • marimo.image_compare: Compare two images side by side.
    • marimo.audio: Play audio files.
    • marimo.video: Play videos.
    • marimo.pdf: Display PDFs.
    • marimo.download: Create download links.
    • marimo.plain_text: Display plain text.
  11. Explore marimo editor features

    main

    The marimo editor is a browser-based IDE designed for reactive programming. It includes several built-in tools for productivity, data inspection, and code intelligence:

    • Dataflow Tools: Includes a variables panel, dependency graph, and minimap to visualize and navigate cell dependencies.
    • Data Explorer: Allows for quick inspection of dataframes and tables.
    • Smart Module Autoreloading: Automatically identifies and notifies you which cells need to be rerun when modules change.
    • Code Intelligence: Features code completion, live documentation previews, and Language Server Protocol (LSP) support for diagnostics.
    • AI Assistance: Supports language-model assisted coding and GitHub Copilot integration.
    • Customization: Supports Vim keybindings and workspace customization via panels.