docs for muutils v0.6.17
View Source on GitHub

# muutils.nbutils

utilities for working with notebooks

- configuring figures mdoes and torch devices: `configure_notebook`
- converting them to scripts: `convert_ipynb_to_script`
- running them as tests: `run_notebook_tests`
- and working with diagrams/LaTeX: `mermaid`, `print_tex`

View Source
View on GitHub

     1"""utilities for working with notebooks
     2
     3- configuring figures mdoes and torch devices: `configure_notebook`
     4- converting them to scripts: `convert_ipynb_to_script`
     5- running them as tests: `run_notebook_tests`
     6- and working with diagrams/LaTeX: `mermaid`, `print_tex`
     7
     8"""
     9
    10from muutils.nbutils.mermaid import mm
    11
    12__all__ = [
    13    # sub-modules
    14    "configure_notebook",
    15    "convert_ipynb_to_script",
    16    "mermaid",
    17    "print_tex",
    18    "run_notebook_tests",
    19    # functions
    20    "mm",
    21]

def mm(graph):
View Source
View on GitHub

    16def mm(graph):
    17    """for plotting mermaid.js diagrams"""
    18    graphbytes = graph.encode("ascii")
    19    base64_bytes = base64.b64encode(graphbytes)
    20    base64_string = base64_bytes.decode("ascii")
    21    display(Image(url="https://mermaid.ink/img/" + base64_string))

for plotting mermaid.js diagrams