No description
Find a file
2021-04-08 22:17:56 +01:00
.chglog Initial commit 2021-04-06 09:14:54 +01:00
.github/workflows Initial commit 2021-04-06 09:14:54 +01:00
docs Update documentation 2021-04-06 22:02:55 +01:00
src Add relative and absolute paths to image export 2021-04-08 22:17:56 +01:00
tests Add relative and absolute paths to image export 2021-04-08 22:17:56 +01:00
.build.yml Initial commit 2021-04-06 09:14:54 +01:00
.gitattributes Update git attributes 2021-04-06 21:52:55 +01:00
.gitignore Initial commit 2021-04-06 09:14:54 +01:00
.tool-versions Initial commit 2021-04-06 09:14:54 +01:00
holst.nimble Add relative and absolute paths to image export 2021-04-08 22:17:56 +01:00
LICENSE Initial commit 2021-04-06 09:14:54 +01:00
README.md Add relative and absolute paths to image export 2021-04-08 22:17:56 +01:00
RunningCode.ipynb Parse metadata 2021-04-06 15:12:29 +01:00

CI builds.sr.ht status

nim-holst

A parser for Jupyter notebooks.

setup

Add holst to your nimble project:

requires "holst"

and run nimble install

examples

reading

Load and parse a Jupyter notebook in /tmp/foo.ipynb:

import holst

let notebook = read("/tmp/foo.ipynb")

metadata

Get the kernel's metadata

echo notebook.metadata.kernelspec.language # => python
echo notebook.metadata.kernelspec.name # => Python 3

exporting

Export the notebook as markdown

let md = notebook.markdown()

Images are rendered as links in Markdown, you can export the image data to files with

notebook.image_prefix = "notebook-img"
notebook.image_rel_path = "./my_images"
notebook.image_dest = "/tmp/html/my_images"
notebook.export_images()

iterating

Apply a method to each code cell:

notebook
    .filter(proc(cell: Cell): bool = cell.kind = Cell.Code)
    .map (
        # do something
    )

compatibility

holst works with Jupyter notebooks with format 4+.

mailing lists

Please prefix the subject with [nim-holst].