Coder Social home page Coder Social logo

ipynb_output_filter's Introduction

ipynb_output_filter

Script for stripping output from ipython/jupyter scripts.

Originally from http://stackoverflow.com/questions/18734739/using-ipython-notebooks-under-version-control/20844506

Usage

Let us assume that the script is saved to ~/bin/ipynb_output_filter.py, and that it is executable (otherwise: chmod +x ~/bin/ipynb_output_filter.py).

Then, create the file ~/.gitattributes with the following content

*.ipynb    filter=dropoutput_ipynb

and run the following commands:

git config --global core.attributesfile ~/.gitattributes
git config --global filter.dropoutput_ipynb.clean ~/bin/ipynb_output_filter.py
git config --global filter.dropoutput_ipynb.smudge cat

Disable/enable on specific repo(s)

To disable the output filtering for a specific git repository, simply create inside it a file .git/info/attributes, with

**.ipynb filter=

as content. Clearly, in the same way it is possible to apply filtering //only// on specific repo(s).

Use specific version of python

If the version of python to be used (i.e. the one with access to IPython libraries) is not located at /usr/bin/python, it can be specified with the filter.dropoutput_ipynb.clean setting. For instance under OSX, if there is a version of Python installed via homebrew, the following:

git config --global filter.dropoutput_ipynb.clean python ~/bin/ipynb_output_filter.py

will use it rather than the system one.

ipynb_output_filter's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.