An open API service indexing awesome lists of open source software.

https://github.com/sasso-effe/notebooks-pre-commit

A pre-commit hook for cleaning python notebooks.
https://github.com/sasso-effe/notebooks-pre-commit

clean-code ipython-notebook pre-commit-hooks

Last synced: 26 days ago
JSON representation

A pre-commit hook for cleaning python notebooks.

Awesome Lists containing this project

README

          

# notebooks-pre-commit

[![GitHub version](https://badge.fury.io/gh/sasso-effe%2Fnotebooks-pre-commit.svg?icon=si%3Agithub)](https://badge.fury.io/gh/sasso-effe%2Fnotebooks-pre-commit)

A [pre-commit](https://pre-commit.com/) hook for cleaning python notebooks.

### Images downscaling

To downscale your notebooks' images via pre-commit, add the following to your `.pre-commit-config.yaml`:

```yaml
repos:
- repo: https://github.com/sasso-effe/notebooks-pre-commit
rev: v0.1.0
hooks:
- id: downscale-notebook-images
```

You can disable conversion of PNG images to JPEG with:

```yaml
repos:
- repo: https://github.com/sasso-effe/notebooks-pre-commit
rev: v0.1.0
hooks:
- id: downscale-notebook-images
args: ["--kep-png"]
```

Other options are:

- `--max-img-res`: Resize images that have one side larger than this number (in pixels). Defaults to 800.
- `--max-file-size`: Ignore notebooks smaller than this size (in KB). Defaults to 512.