Warning
This plugin is currently unmaintained!
pyroam
lets you execute python code inside Roam Research using pyodide. Now you can do literate programming!
Showcase video: (Watch on Loom
pyroam.mp4
The main thing you need to know are the two following keybindings:
Keybinding | Action |
---|---|
<Alt+Enter> | Run current cell and write |
<Alt+Shift+Enter> | Run all cells in active notebook and write |
When a codeblock is run, the output is written to the block nested one below it.
The fastest way to add a Python codeblock in Roam is by typing /python
and pressing Enter.
By default, the current page is the active notebook, i.e., when you press <Alt+Shift+Enter>, all blocks on the current page get run and their outputs are written.
You can designate a smaller portion of the page to be the active notebook by referencing the page [[pyroam/notebook]]
in the parent block, i.e. all blocks nested under this blocks will get run when pressing <Alt+Shift+Enter>, but no other. You can also nest notebooks - the plugin will always run the "smallest" one.
All variables are shared, it's like if the code blocks were one script.
Currently, numpy
, matplotlib
and scipy
get loaded, though numpy
tends to be buggy and plot generation with matplotlib
doesn't work yet.
In the future, the plugin will load all imported packages dynamically (as long as pyodide
, the underlying Python browser compiler, allows it).
You can create issues or pull requests in the repository or DM me on Twitter (https://twitter.com/adam_krivka)