项目作者: larsklitzke

项目描述 :
Cleanup Jupyter notebooks
高级语言: Python
项目地址: git://github.com/larsklitzke/jp-cleanup.git
创建时间: 2019-11-23T13:26:49Z
项目社区:https://github.com/larsklitzke/jp-cleanup

开源协议:

下载


Jupyter notebook cleanup

Working with PyCharm and your Jupyter notebooks becoming quite heavy and slow down your system? This project contains
some tools to cleanup you Jupyter notebooks.

Usage

You may want to remove the output of all cells since loading the notebook takes ages. You can either use jp-cleanup
on the command line or programmatically.

Command-line

At first, install jp-cleanup with pip using the version on GitHub

  1. pip install git+https://github.com/larsklitzke/jp-cleanup.git

or on PyPi

  1. pip install jp-cleanup

After installation, you can clear the output fields of a notebook testing with

  1. jp-cleanup --file testing.ipynb --clear

with --clear being an extra flag to not remove the output of a notebook accidentally.

To list all available parameters or view the current version, run jp-cleanup with the --help flag.

  1. jp-cleanup --help

Python

Instead of running jp-cleanup on the command-line, you can also use the package in Python. To remove the outputs of
a certain jupyter notebook testing, load the file

  1. import jpcleanup as jpc
  2. path, content = jpc.load('testing') # or with .ipynb

reset the output of all cells

  1. content = jpc.clear_field(content)

and write the result back to either the same file

  1. jpc.save(content, path)

or a new file

  1. jpc.save(content, 'test-result') # or with .ipynb

Installation

Either clone this project with

  1. git clone https://github.com/larsklitzke/jp-cleanup

to extend the functionality of the project or, since the the project is hosted on PyPi, install it with

  1. pip install jp-cleanup

or

  1. pip install git+https://github.com/larsklitzke/jp-cleanup.git

License

Copyright (C) 2019 Lars Klitzke, Lars.Klitzke@gmail.com

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.