Skip to main content

EDIT: May 2016 (updated February 2017): there are several alternatives to my script - for completeness, here is a list of those I know: nbstripoutnbstripout (other variants), nbstrip, jq.

EDIT: May 2016 (updated February 2017): there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip, jq.

EDIT: May 2016 (updated February 2017): there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip, jq.

the content of the suggested edit actually made sense, although a comment would have served better
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45

EDIT: May 2016 (updated February 2017): there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip, jq.

EDIT May 2016: there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip.

EDIT: May 2016 (updated February 2017): there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip, jq.

alternatives
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
  1. Save a file with this contentthis content somewhere (for the following, let us assume ~/bin/ipynb_output_filter.py)

  2. Make it executable (chmod +x ~/bin/ipynb_output_filter.py)

  3. Create the file ~/.gitattributes, with the following content

    *.ipynb filter=dropoutput_ipynb

  4. 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

EDIT May 2016: there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip.

  1. Save a file with this content somewhere (for the following, let us assume ~/bin/ipynb_output_filter.py)

  2. Make it executable (chmod +x ~/bin/ipynb_output_filter.py)

  3. Create the file ~/.gitattributes, with the following content

    *.ipynb filter=dropoutput_ipynb

  4. 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

  1. Save a file with this content somewhere (for the following, let us assume ~/bin/ipynb_output_filter.py)

  2. Make it executable (chmod +x ~/bin/ipynb_output_filter.py)

  3. Create the file ~/.gitattributes, with the following content

    *.ipynb filter=dropoutput_ipynb

  4. 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

EDIT May 2016: there are several alternatives to my script - for completeness, here is a list of those I know: nbstripout (other variants), nbstrip.

adding ipython (suggested by comment)
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
code moved to git repo
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
support jupyter
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
remove "execution_number"
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
inserted DaveP's suggestion on dropping signature
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
delete "prompt_number"
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
indenting
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
neutralize for specific repos
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
answer to mforbes
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
why this answer (on top)
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading
Source Link
Pietro Battiston
  • 8.3k
  • 3
  • 45
  • 45
Loading