Skip to content

Commit

Permalink
add option to strip ipynb output
Browse files Browse the repository at this point in the history
  • Loading branch information
n-wbrown committed Jul 24, 2024
1 parent 6f849f1 commit 8db6c1b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"auto_git_setup": ["no", "yes"],
"git_remote_name": "origin",
"readme_format": ["md", "rst"],
"simple": ["yes", "no"]
"simple": ["yes", "no"],
"strip_ipynb_outputs": ["yes", "no"]
}
3 changes: 3 additions & 0 deletions hooks/post_gen_project.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash
git init
{% if cookiecutter.strip_ipynb_outputs == "yes" %}
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'
{% endif %}
{% if cookiecutter.auto_git_setup == "yes" %}
git add -A
git remote add {{ cookiecutter.git_remote_name }} [email protected]:{{ cookiecutter.github_repo_group }}/{{ cookiecutter.repo_name }}.git
Expand Down
4 changes: 4 additions & 0 deletions {{ cookiecutter.folder_name }}/.gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.git_archival.txt export-subst

{% if cookiecutter.strip_ipynb_outputs=="yes"%}
*.ipynb filter=strip-notebook-output
{%endif%}

0 comments on commit 8db6c1b

Please sign in to comment.