VACILT / SSW_project

MIT License
0 stars 0 forks source link

Prepare jupyter book for discussion #9

Closed kuchaale closed 3 years ago

kuchaale commented 3 years ago

See VACILT/trend_paper/#4 or my book here.

kuchaale commented 3 years ago

The Github page is ready on this address: https://vacilt.github.io/SSW_project/. So far it is set to be built from the /docs folder in the master branch. We can manually put the content there as stated here.

kuchaale commented 3 years ago

I would like to add hide-input tag to all notebooks. It will enhance readability (see here). You can adapt the following script:

import os.path
import nbformat as nbf
from glob import glob

notebooks = glob(os.path.join(path, "*.ipynb"))

for ipath in notebooks:
    ntbk = nbf.read(ipath, nbf.NO_CONVERT)

    for cell in ntbk.cells:
        cell_tags = cell.get("metadata", {}).get("tags", [])
        if len(cell_tags) == 0:
            cell_tags.append("hide-input")
        cell["metadata"]["tags"] = cell_tags

    nbf.write(ntbk, os.path.join(path, os.path.splitext(os.path.basename(ipath))[0]+"_clean.ipynb"))