What's Changed
Release 0.13.0 introduces includes a big new feature: it's now possible to import functions and classes from marimo notebooks, as long as they meet certain criteria. This lets you write code like:
from my_notebook import my_function, my_class
This feature, contributed by @dmadisetti, is yet another way that marimo's pure Python format makes your notebook code reusable.
Reusable functions and classes
Starting with 0.13.0, you can import top-level functions and classes defined in a marimo notebook into other Python scripts or notebooks using normal Python syntax, as long as your definitions satisfy the following criteria:
- The cell must define just a single function or class.
- The defined function or class can only refer to symbols defined in the setup cell, or to other top-level symbols.
The setup cell is a new addition to marimo: it is an optional cell in which you can include modules used by functions and classes you'd like your notebook to expose.
When you create a cell containing just a single function or class, marimo will provide hints in the bottom-right that tell you if the criteria are met ...
... or if not what needs to be done to meet the criteria:
To learn more, visit our docs.
More legible markdown
Design is important to us; that's why markdown is now rendered with a maximum width of ~80 characters, improving legibility.
All changes
- fix: ui tweaks for saving secrets by @mscolnick in #4558
- break: markdown width clamped for more readable typography by @mscolnick in #4551
- docs: new file format documentation by @dmadisetti in #4497
- fix: Address mep feedback by @dmadisetti in #4557
- feat: display singular label in
FileUploadPlugin
for single files by @peter-gy in #4569 - fix: remove auto-scroll from chat by @mscolnick in #4561
- Remove (#faq-show-code) from show code FAQ by @JoostGevaert in #4559
- feat: release reusable functions by @dmadisetti in #4560
- examples: refresh fastapi example by @dmadisetti in #4562
- docs: minor function fileformat edits by @akshayka in #4576
- docs: update links to examples and gallery by @akshayka in #4577
- fix: use context.issue in notify translators by @akshayka in #4587
- fix: get node version edge case by @akshayka in #4590
- stop gap: check header for race condition by @dmadisetti in #4589
New Contributors
- @JoostGevaert made their first contribution in #4559
Full Changelog: 0.12.10...0.13.0