Skip to main content

anywidget for embedding metaframe URLs in Jupyter and marimo notebooks

Project description

metaframe-widget

An anywidget for embedding metaframe and metapage URLs in Jupyter and marimo notebooks.

Install

pip install metaframe-widget

With environment extras:

pip install "metaframe-widget[jupyter]"   # includes jupyterlab
pip install "metaframe-widget[marimo]"    # includes marimo

Quick start

Jupyter

from metaframe_widget import MetaframeWidget

w = MetaframeWidget(url="https://js.mtfm.io/#?js=...", height="300px")
w

marimo

import marimo as mo
from metaframe_widget import MetaframeWidget

w = MetaframeWidget(url="https://js.mtfm.io/#?js=...", height="300px")
mo.ui.anywidget(w)

Create from inline JavaScript

w = MetaframeWidget.from_code("""
  setOutput("result", getInput("data") * 2);
""", height="300px")

API reference

Parameter Type Default Description
url str "" Full metaframe URL (including hash params)
inputs dict {} Dict of inputs to push to the metaframe
outputs dict {} Dict of outputs received from the metaframe (read-only)
width str "100%" CSS width for the widget container
height str "400px" CSS height for the widget container
allow str "" iframe allow attribute (e.g. "camera; microphone")

Methods

  • set_inputs(d) — merge a dict into current inputs
  • set_input(key, value) — set a single input key
  • on_outputs_change(callback) — register a callback for output changes
  • from_code(js_code, **kwargs) — class method to create a widget from inline JS
  • pipe_to(target, output_key, input_key=None) — connect an output to another widget's input

Piping widgets

source = MetaframeWidget(url="...")
sink = MetaframeWidget(url="...")
source.pipe_to(sink, output_key="result", input_key="data")

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metaframe_widget-0.3.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metaframe_widget-0.3.5-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file metaframe_widget-0.3.5.tar.gz.

File metadata

  • Download URL: metaframe_widget-0.3.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for metaframe_widget-0.3.5.tar.gz
Algorithm Hash digest
SHA256 b467cac809683c1d9d1291369b0e1968d40718b5a0de1bc5690e816a5a5051c2
MD5 86cd331d51b08eacbcadb0263bbd6733
BLAKE2b-256 bce69b17aba2895167a9f342bc5af478f20cdb3b45016b159448b0e2d5ea7817

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaframe_widget-0.3.5.tar.gz:

Publisher: publish-python.yml on metapages/metaframe-js

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file metaframe_widget-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for metaframe_widget-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 64a47ff1d5fafa0b19298c16285398f3b14c0102257c0e3ece69f2d24e65d5ac
MD5 ba1b39598a8bab6dc7bc434a70905dcd
BLAKE2b-256 fa4fb08d16e4c418fe557f40854aeed6f43f226bd5f40b76cde1a938dfb8ec52

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaframe_widget-0.3.5-py3-none-any.whl:

Publisher: publish-python.yml on metapages/metaframe-js

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page