From be54cdeea495b2f6f79b277d8550ac5a15a3a088 Mon Sep 17 00:00:00 2001 From: Jinglei Ren Date: Thu, 7 Sep 2017 01:25:37 +0800 Subject: [PATCH] Add notebook stripping scripts --- .gitattributes | 1 + .gitconfig | 8 ++++++++ README.md | 10 ++++++++-- gitconfig.sh | 3 +++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .gitattributes create mode 100644 .gitconfig create mode 100755 gitconfig.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..2c2ef3020c8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.ipynb filter=nbstrip_full diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 00000000000..7f67a308020 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,8 @@ +[filter "nbstrip_full"] +clean = "jq --indent 1 \ + '(.cells[] | select(has(\"outputs\")) | .outputs) = [] \ + | (.cells[] | select(has(\"execution_count\")) | .execution_count) = null \ + | .cells[].metadata = {} \ + '" +smudge = cat +required = true diff --git a/README.md b/README.md index ec7622eb0af..0b4815239b1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Note: Python 3.5+ is required. Install packages dicttoxml gitpython lxml networkx numpy openpyxl statistics scipy matplotlib: -E.g., Ubuntu: +E.g., on Ubuntu: ``` sudo apt install -y python3 python3-pip sudo -H pip3 install dicttoxml gitpython lxml networkx numpy openpyxl statistics scipy matplotlib @@ -34,12 +34,18 @@ cd misc/ Reference . -E.g., Ubuntu: +E.g., on Ubuntu: ``` sudo -H pip3 install --upgrade pip sudo -H pip3 install jupyter ``` +To fit notebooks well in git, install jq and run gitconfig.sh. E.g., on Ubuntu: +``` +sudo apt install -y jq +./gitconfig.sh +``` + 3. Install TensorFlow Follow this tutorial: https://www.tensorflow.org/install/install_sources. diff --git a/gitconfig.sh b/gitconfig.sh new file mode 100755 index 00000000000..c12930f39f4 --- /dev/null +++ b/gitconfig.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +git config --local include.path ../.gitconfig