https://github.com/koaning/mofresh
Widgets that can automatically refresh in marimo
https://github.com/koaning/mofresh
anywidget marimo
Last synced: 19 days ago
JSON representation
Widgets that can automatically refresh in marimo
- Host: GitHub
- URL: https://github.com/koaning/mofresh
- Owner: koaning
- License: mit
- Created: 2025-05-07T08:33:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-05T15:39:59.000Z (8 months ago)
- Last Synced: 2025-11-05T17:32:41.851Z (8 months ago)
- Topics: anywidget, marimo
- Language: Python
- Homepage: https://koaning.github.io/mofresh/
- Size: 6.78 MB
- Stars: 25
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

### Mofresh
Widgets, designed for marimo, that can automatically refresh
## Installation
You can install the package using pip:
```bash
uv pip install mofresh
```
## Usage
The goal of this project is to offer a few tools that make it easy for you to refresh charts in marimo. This can be useful during a PyTorch training loop where you might want to update a chart on every iteration, but there are many other use-cases for this too.
### Widgets
The library provides three widgets:
1. **`ImageRefreshWidget`** - Displays images that can be updated dynamically. Perfect for refreshing matplotlib plots or any image content.
2. **`HTMLRefreshWidget`** - Renders HTML content that can be updated on the fly. Great for Altair charts, plotly visualizations, or custom HTML.
3. **`ProgressBar`** - A modern progress bar with dark mode support. Ideal for tracking training loops or long-running operations.
## How it works
The trick to get updating charts to work is to leverage [anywidget](https://anywidget.dev/). These widgets have a loop that is independant of the marimo cells which means that you can update a chart even if the cell hasn't completed running. The goal of this library is to make it easy to use this pattern by giving you a few utilities.
Effectively that means you can expect to see stuff like this in marimo:

## Live demo
If you want to dive deep and experience the API, the best way is to explore the live notebook on [Github pages](https://koaning.github.io/mofresh/).
[Go to live docs.](https://koaning.github.io/mofresh/)