Skip to main content

modist

Interactive distribution widgets for marimo, in the style of koaning/wigglystuff. Drag the density curve to shape a distribution, then feed the params straight into a distribution constructor with a single splat.

Install

uv add modist            # or: uv pip install modist  (pip install modist)

Quickstart

import marimo as mo
import modist as md

w = mo.ui.anywidget(md.Normal())
w
params = w.value            # {'mu': ..., 'sigma': ...}
import pymc as pm
dist = pm.Normal.dist(**params)   # or pm.Beta / pm.Gamma

Families

Widget Params Domain Drag affordances
Normal mu, sigma free mean line → mu, ±1σ squares → sigma
Beta alpha, beta fixed [0, 1] mean line → translate, q25/q75 squares → concentrate
Gamma alpha, beta edge pinned at 0 mean line → translate, q25/q75 squares → reshape

alpha/beta follow the PyMC / statistics convention (Gamma's beta is the rate, not scipy's scale). The lazy .scipy and .pymc adapters map to the right parametrization automatically:

n = md.Normal(mu=2.0, sigma=3.0)
n.scipy   # <scipy.stats.norm> via loc=/scale=
n.pymc    # pm.Normal.dist(mu=2.0, sigma=3.0)

g = md.Gamma(alpha=2.0, beta=3.0)
g.scipy   # scipy.stats.gamma(a=2.0, scale=1/3)  -- rate handled for you

w.value is a plain dict of the synced traits, so pm.X.dist(**w.value) works with no conversion.

How it works

Each family is its own anywidget class with a small set of synced parameter traits (no x_min/x_max/n_points). The view — SVG scaffold, pan/zoom, draggable hit lines, and per-family math — lives in a self-contained ESM module.

Source JS lives in js/ (js/base.js shared scaffold + one family file, all importing a vendored copy of jStat for pdf/cdf/quantile math). Anywidget delivers _esm as a Blob URL, which cannot resolve relative imports, so esbuild bundles each family (jStat inlined) into the committed src/modist/static/*.js files — the same pattern wigglystuff uses for its JS-heavy widgets.

Rebuilding the JS

make js          # esbuild js/*.js -> src/modist/static/*.js
make js-watch    # rebuild on every edit (for anywidget hot-reload dev)

Requires a local esbuild (npm install --no-save esbuild).

Development

make venv        # creates .venv with dev deps + esbuild
make test        # pytest
npm run test:js  # Playwright JS integration probes (headless Chromium)

Acknowledgements

  • jStat — JavaScript statistics library (MIT), vendored and bundled for the pdf/cdf/quantile math.
  • wigglystuff — the interaction and architecture model (one class per family, prebuilt ESM per class).

Download files

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

Source Distribution

modist-0.1.0.tar.gz (85.0 kB view details)

Uploaded Source

Built Distribution

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

modist-0.1.0-py3-none-any.whl (88.3 kB view details)

Uploaded Python 3

File details

Details for the file modist-0.1.0.tar.gz.

File metadata

  • Download URL: modist-0.1.0.tar.gz
  • Upload date:
  • Size: 85.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","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}

File hashes

Hashes for modist-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f948afd0c8791f8eb826a31dffba9e5c799c884cc88f70d73c2bc1947102c54a
MD5 21663bb7e5db9dc86db9fb948367c733
BLAKE2b-256 c73dbc4630bba8346a7a8b5461385c7dbd678706e37d1a06a27f2c42de4d4261

See more details on using hashes here.

File details

Details for the file modist-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: modist-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 88.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","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}

File hashes

Hashes for modist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c233dbe518d8944dd936c54133bd2c2da4ef15e04dd4afdf944e0868880e000f
MD5 d4b848de365dc8b8c7fd6546c3aec763
BLAKE2b-256 43f169e069bc89b0de8e0e68731e3a8c13679dba0cfcc881424e54967c582251

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

This release

0.1.0 This release

2 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