Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Filter .ipynb (nbformat) files to improve integration with version control systems (VCS)

Project description

nbfilter

PyPI version

Filter .ipynb (nbformat) files to improve integration with version control systems (VCS), specifically git.

Setup

Install from PyPI:

pip install nbfilter

Use from the command line:

python -m nbfilter.clean < research.ipynb | sponge research.ipynb

Integrate into git:

From your repository's root directory:

Run the following command to implement a filter called ipynbfilter in your .git/config settings:

git config filter.ipynbfilter.clean 'python -m nbfilter.clean'

Then run one of the following command sequences to trigger it for all files with the .ipynb extension:

printf '*.ipynb filter=ipynbfilter\n' >> .gitattributes # Apply filter for all contributors
git add .gitattributes

or:

printf '*.ipynb filter=ipynbfilter\n' >> .git/info/attributes # Apply filter for just me

To apply it to files that are already under source control (for example, so that diffing subsequent changes produces more intelligible results):

git add --renormalize . # (re-)apply filters to all files currently under source control

or:

git add --renormalize research.ipynb # (re-)apply filters to a single file

References / alternatives

License

Copyright (c) 2018 Christopher Brown. MIT Licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for nbfilter, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size nbfilter-1.0.0-py2.py3-none-any.whl (3.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size nbfilter-1.0.0.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page