Integrate Matplotlib's WebAgg backend with Starlette for real-time plotting in web applications.
Project description
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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mplbed-0.1.0.tar.gz.
File metadata
- Download URL: mplbed-0.1.0.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b3dce9b5e143efa009d8bed493c8ff21d674264cc87a49ec74c4eba3479c5ee
|
|
| MD5 |
d95c2ca168b3deba2387f07666351702
|
|
| BLAKE2b-256 |
b09b1f64daf80fbb747ce64078b174ff886a9cb0c68a55ace612c31176b97290
|
File details
Details for the file mplbed-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mplbed-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fdb0f4e97c2ead13f9bfa7e3b64a4c657120a13ddc35686362b3d2ee4b23233
|
|
| MD5 |
67d2cb359092497c50dc41ec6258984c
|
|
| BLAKE2b-256 |
ff7628c89d7f7459781cabd961ba08c71a8cef4f504b5931b2f51ad029862787
|