Skip to main content

marimo-functions

Flexible interface for defining functions with marimo UI inputs

What is a "Marimo Function"

When running analysis in marimo, it is common to have a set of inputs which are all mapped as inputs to a particular function. The marimo-functions library provides a simple framework for implementing this pattern of user interaction.

The MarimoFunction class has an inputs attribute which maps keyword arguments to marimo UI elements. The type attribute of each input specifies the UI element, and all of the remaining kwargs are passed to the constructor.

The run() method then takes the kwargs provided by the user and runs any method that consumes them appropriately.

For example:

from marimo_functions import MarimoFunction
from sklearn.manifold import TSNE as SKTSNE


class TSNE(MarimoFunction):
    """
    A class representing a t-SNE (t-distributed Stochastic Neighbor Embedding) function.
    """
    inputs = {
        "n_components": {
            "type": "number",
            "label": "Number of components",
            "value": 2,
            "start": 1,
            "step": 1
        },
        "perplexity": {
            "type": "number",
            "label": "Perplexity",
            "value": 30,
            "start": 5,
            "stop": 50,
            "step": 1
        },
        "early_exaggeration": {
            "type": "number",
            "label": "Early exaggeration",
            "value": 12.0,
            "start": 1.0,
            "stop": 100.0,
            "step": 0.1
        },
        "random_state": {
            "type": "number",
            "label": "Random State",
            "value": 0
        }
    }
    name = "t-SNE"
    description = "T-distributed Stochastic Neighbor Embedding."

    @classmethod
    def run(cls, **kwargs) -> SKTSNE:
        return SKTSNE(**kwargs)

Using a Function

To make use of a function in marimo, simply prompt the user for the inputs:

# func: MarimoFunction
inputs = func.prompt()
inputs

Note that by using inputs as the last line in the marimo cell, it is presented as a UI element to the user.

And then run the function using the values provided by the user:

output = func.run(**inputs.value)

Picking a Function

In addition to the single function, this library provides a mechanism for selecting a function of interest from a dropdown menu.

from marimo_functions import PickFunction

selected_function = (
    PickFunction(
        functions=[
            FunctionA,
            FunctionB,
            FunctionC,
            FunctionD,
            FunctionE
        ]
    )
    .prompt(
        label="Select a function",
        value="Function A"
    )
)
selected_function

The function selected by the user can be populated by the value attribute.

func = selected_function.value

# Display the description of the function
mo.md(func.description)

Interactive Example

To run a marimo notebook displaying this functionality:

  1. Set up the local environment (uv sync)
  2. Launch the notebook (uv run marimo edit example.py)

Metadata

Release files for marimo-functions 0.4.0

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

Source distribution (sdist)

Source distribution for marimo-functions 0.4.0
File Size Uploaded Provenance Actions
marimo_functions-0.4.0.tar.gz 7.9 kB With provenance Details for marimo_functions-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for marimo-functions 0.4.0
File Interpreter ABI Platform Actions
marimo_functions-0.4.0-py3-none-any.whl Python 3 none any Details for marimo_functions-0.4.0-py3-none-any.whl

Total release size: 18.5 kB

Release files / marimo_functions-0.4.0.tar.gz

Download URL marimo_functions-0.4.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
77b9c1f1c87ed5690e0557fc3634897371b8e18587bd63f75c7fb2524d36cd8e
BLAKE2b-256 checksum
How to use checksums
ef05a22b26129baa20ac93d94e6c5d6f4025ce57338198cdffac748609eeb20f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

Release files / marimo_functions-0.4.0-py3-none-any.whl

Download URL marimo_functions-0.4.0-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0c1dd26bec321a15701a04fa3b39340396231e2121c605834278f524cfd4b81d
BLAKE2b-256 checksum
How to use checksums
84ba1b6d2d692e2bec21383766170817e0aeaefe57574fcb1340e07b8d376066
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

Security for marimo-functions 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for marimo_functions-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 10, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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