Skip to main content

mplbed

|[]mpl
|======|
|  bed |

mplbed is a library of support code for embedding interactive, server-side matplotlib figures in web applications.

Supporting, in principle any ASGI-compatible Python application, it provides convenient integration for a number of frameworks ones out of the box. It aims to have "usually-works" defaults useful for quick demos, while providing a lot of flexibility and options as well as utilities to deal with advanced issues such as style isolation, and connection and resource management to enable some degree of scaling up to use-cases like internal dashboards.

It can be as easy as:

import mywebframework
from mplbed import mplbed_mywebframework

@mywebframework.route("/myplot")
@mplbed_mywebframework.figure_page
def my_plot_page(request):
    fig, ax = plt.subplots()
    ax.plot([1, 2, 3], [4, 5, 6])
    return fig

app = mywebframework.App(...)
setup(app)

Installation

Currently you can install this package from Github:

$ uv add git+https://github.com/frankier/mplbed

Install the optional NiceGUI integration with:

$ uv add "mplbed[nicegui]"

Then configure the NiceGUI app before ui.run() and create an interactive element with mplbed.integration.nicegui.matplotlib.

Documentation

The documentation includes API docs and examples.

Contributing

Contributions are welcome. Please discuss any larger changes in the issues before making a pull request to avoid wasted work. You, the human contributor, must personally have reviewed and understood any code submitted.

Set up a dev environment with uv:

$ uv sync --all-groups --all-extras

Run the tests (end-to-end tests need Playwright browsers: uv run playwright install chromium):

$ uv run pytest

Lint, format and typecheck:

$ uv run ruff check ./src
$ uv run ruff format ./src
$ uv run ty check ./src

Install the prek hook to run these automatically on commit:

$ prek install

Metadata

Release files for mplbed 0.2.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 mplbed 0.2.0
File Size Uploaded
mplbed-0.2.0.tar.gz 18.4 kB Details

Built distribution (wheel)

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

Total release size: 45.2 kB

Release files / mplbed-0.2.0.tar.gz

Download URL mplbed-0.2.0.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a79e9095e701387657db38f7cca8f3e87b6ec3aeff951c6d95ca66d36ff2234a
BLAKE2b-256 checksum
How to use checksums
29cb3467d841eccafa7e4db26b82dcb388cedafef340be69b015066f44181d7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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 / mplbed-0.2.0-py3-none-any.whl

Download URL mplbed-0.2.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc6de287413d1f0528842d4e68f5af1053c26054b9f5160d2b1a7e484083e1f0
BLAKE2b-256 checksum
How to use checksums
c178d20e2379d9bb2561d6719c230fb6d1094d3c8ebe6ee0c2d7d4c515bebdd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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

0.3.0

2 release files

This release

0.2.0 This release

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