diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d60debf8541b2fe8104f943dc745d43326c18e4b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/kynan/nbstripout + rev: 0.7.1 + hooks: + - id: nbstripout diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b38464bacd52af8cbb4ee9d16da144518971166c..5ce119ee7956b438604b976d7f29180baf662c9f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,13 +7,12 @@ All contributions are welcome, but please read this first. If you intend to contribute, please install first the pre-commit hook: ```shell -cp Scripts/pre-commit .git/hooks/pre-commit +conda install -c conda-forge pre-commit # or pip install pre-commit +pre-commit install ``` This hook clears executed cells when committing a notebook. -You need [nbconvert](https://nbconvert.readthedocs.io/en/latest/) to be installed for this pre-commit hook to work properly; it is done automatically if you're using the provided miniconda environment. - ## Workflow diff --git a/Scripts/pre-commit b/Scripts/pre-commit deleted file mode 100755 index 378e760eb5aba8ba5889865f87feab8cdd8e773e..0000000000000000000000000000000000000000 --- a/Scripts/pre-commit +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -# This file is expected to be use as pre-commit git hook; copy it in .git/hooks/ - -file_list=`git diff --cached --diff-filter=ACM --name-only` - -for file in ${file_list} -do - if [ "${file##*.}" = "ipynb" ]; then - echo "Clear cells from ${file}" - jupyter nbconvert --clear-output --inplace ${file} - git add ${file} - fi -done diff --git a/environment.yml b/environment.yml index 1cd2f9237caeda616ccf373396b262f1b712fa8e..a1c0be00657612399a5d37a4580000abc26e0355 100644 --- a/environment.yml +++ b/environment.yml @@ -4,4 +4,3 @@ channels: dependencies: - jupyterlab - xeus-cling - - nbconvert