项目作者: amirhm

项目描述 :
format jupyter notebooks
高级语言: Python
项目地址: git://github.com/amirhm/mynb.git
创建时间: 2020-09-01T13:50:16Z
项目社区:https://github.com/amirhm/mynb

开源协议:MIT License

下载


https://github.com/amirhm/mynb/actions?query=workflow%3AWindows

Formating the jupyter notebooks

An small package to clear all the outputs of a jupyter notebooks.

To use versioning on the notebooks, it is practical to clear the outputs of all cells (to only keep the code).
The outputs are written in the same notebook file in binary format (base64) and are huge in size and not suitable to be versioned.
This simple package adds a command to removes all the cell output (similar to invoking “Clear all outputs” from the jupyetr menu) and could be added on the pre-commit hooks.

Jupyter itself has a command to do this, but not very reliable always

  1. jupyter nbconvert --clear-outputs ...

Install

  1. pip install mynb

this will install the mynb as an standalone console application (CLI), where can be run from terminal.

  1. >> mynb [filename] [options]
  2. filename: filename or path to the ipynb, possible to use the wildcards
  3. to apply multiple notebooks (mynb *.ipynb)
  4. options:
  5. -h, --help show this help message
  6. --inplace, -p by default the command re-write the files, if this switch is use new file with "_cleared" suffix is created
  7. --quite, -q do not print anything