From d4b59e702d2f83d2755e5dd6ab6b9a37befcdf39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Wed, 6 Mar 2019 12:02:49 +0100 Subject: [PATCH] Add Makefile --- CONTRIBUTING.md | 26 ++++++++++++++++++++++++++ Makefile | 10 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Makefile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index daa1bcc..8c2dd9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,10 +20,36 @@ pip install nbstripout nbstripout --install ``` This will install a git hook that strips all metadata from the notebooks before you commit changes to git. + +You can also remove the output from all cells using this command: + +``` +make clean +``` + +To limit the command to a specific folder (e.g. ml1): +``` +make FOLDER=ml1 clean +``` 4. Submit your pull request on GitHub. 5. A member of the GSI-UPM group will review your request. 6. The reviewer may ask for further changes before merging the contribution. Please, follow the reviewer's instructions before resubmitting. + +## Testing the changes + +You can execute all notebooks at once to make sure they work with this command: + +``` +make exec +``` + +To only check notebooks in a specific folder, run: + +``` +make FOLDER=ml2 exec # Run all notebooks in the ml2 folder +``` + ## Code of Conduct ### Our Pledge diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5cfd73d --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +FOLDER:=. + +exec: + find $(FOLDER) -iname '*.ipynb' -print0 | xargs -n 1 -0 sh -c 'jupyter nbconvert --execute --ClearOutputPreprocessor.enabled=True --inplace $$0 || exit 255' + +clean: + find $(FOLDER) -iname '*.ipynb' -print0 | xargs -n 1 -0 sh -c 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace $$0 || exit 255' + + +.PHONY: exec clean