Skip to content

Instantly share code, notes, and snippets.

@gjlondon
Created November 3, 2018 21:37
Show Gist options
  • Save gjlondon/65ce0a17bb0ea472ec41ae4710e0b36b to your computer and use it in GitHub Desktop.
Save gjlondon/65ce0a17bb0ea472ec41ae4710e0b36b to your computer and use it in GitHub Desktop.
Recipe for stripping outputs before using nbdime to compare Jupyter notebooks
alias nbstrip_jq="jq --indent 1 \
'(.cells[] | select(has(\"outputs\")) | .outputs) = [] \
| (.cells[] | select(has(\"execution_count\")) | .execution_count) = null \
| .metadata = {\"language_info\": {\"name\": \"python\", \"pygments_lexer\": \"ipython3\"}} \
| .cells[].metadata = {} \
'"
nbdime diff-web <(nbstrip_jq <1st notebook>) <(nbstrip_jq <2nd notebook>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment