Skip to main content

mowidgets

Reuse marimo notebooks as widgets inside other marimo notebooks! This allows to build libraries of reusable widgets and distribute them.

This uses native marimo features and the standard Python library; no extra dependencies.

Installation

pip install mowidgets

Tutorial

As an example, we create a simple widget that multiplies two numbers and displays the result.

screenshot of a mowidget

  1. Create a marimo notebook to define the widget.

    marimo edit multiply.py  # widget module name
    

screenshot of a mowidget

  1. Create a marimo notebook for the main app.

    marimo edit app.py
    
  2. From the multiply (widget module name) Python module, import the app variable.

    from multiply import app as multiply_app
    
  3. Use mowidgets.widgetize() on the marimo.App instance to create the widget.

    multiply_widget = mowidgets.widgetize(multiply_app)
    
  4. Call await in front of the widget instance to render it.

    await multiply_widget
    
  5. Using mowidgets.widgetize(..., data_access=True) allows to read values exposed by the widget. You even get autocompletion!

screenshot of a mowidget

See the examples/ directory to see complete files.

Known limitations

  • Using a setup cell cell in the primary notebook seems to create issues where the widget blocks the primary execution loop. Replacing the setup cell by regular cell avoids the problem.

Next steps

  • Pass starting values to the MoWidget instance. This would allow to compose widgets together. (Idea well-received by the core dev team)
  • Have MoWidget expose a reliable input and output schema. Optionally add type coercion via Pydantic.
  • Simplify the import experience. Currently, the user must import the marimo.App instance in the main namespace for the widget to properly refresh.

Metadata

Release files for mowidgets 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mowidgets 0.2.1
File Size Uploaded
mowidgets-0.2.1.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mowidgets 0.2.1
File Interpreter ABI Platform
mowidgets-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.3 kB

Release files / mowidgets-0.2.1.tar.gz

Download URL mowidgets-0.2.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d3e154e1c27c8c97f31500cda13bcd32bc508df8de2801c3daae56dbb61f2332
BLAKE2b-256 checksum
How to use checksums
b5fbf4f2f25e9df46e5bb5342201d6851b7b7449f69aa7673612c8ae5d152f8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mowidgets-0.2.1-py3-none-any.whl

Download URL mowidgets-0.2.1-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e3afe2d05fbbed44a038e3ae83a74d2892107e78ba65b300d0b2944d2135dd5
BLAKE2b-256 checksum
How to use checksums
1ddd4466399c8151f34efc38a1eefaa183c0d7f71d5f519a84001c71d06e43a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page