Turn Python scripts into handouts with Markdown comments and inline figures. An alternative to Jupyter notebooks without hidden state and using your own text editor.
Code | Handout |
---|---|
You use Python Handout as a library inside a normal Python program:
- Install via
pip3 install -U handout
. - Run your script via
python3 script.py
. (You can start with theexample.py
from the repository.) - Open
output/index.html
in your browser to view the handout. - Iterate and refresh your browser.
Create the handout via doc = handout.Handout(outdir)
to access these features:
Feature | Example |
---|---|
Add Markdown text as multi-line comments. | """Markdown text""" |
Add matplotlib figures. | doc.display(fig, width=1.0) |
Add print messages. | doc.write('text:', value) |
Add custom HTML. | doc.html(string) |
Generate the report to <outdir>/index.html . |
doc.save() |
Pro tip: You can save multiple times for fast feedback.
Feel free to create an issue on Github.