kynan / nbstripout

strip output from Jupyter and IPython notebooks
Other
1.19k stars 95 forks source link

exclude folder option #99

Closed Luttik closed 4 years ago

Luttik commented 5 years ago

Hé,

I love this plugin and I use it with all my repositories. However, I would love to be able to use it in conjunction with nbsphinx. I currently copy my notebooks to the ./docs folder to let sphinx compile it for documentation. Id love to exclude the docs folder from nbstripout in my .gitattributes such that it can use the notebook output in my docs without having to run them again (and taking a lot of time for data-science jobs).

kynan commented 5 years ago

Note that you can do this already by modifying .git/info/attributes (or .gitattributes if you choose to use that) and adding the following line:

docs/** filter= diff=

This will disable nbstripout for any file in the docs directory.

To check which attributes a given file has with the current config, run

git check-attr -a -- path/to/file

Is that sufficient for your use case?

I'm not sure it's worth add an extra flag for this use case, but documenting it would be useful.

kynan commented 5 years ago

@Luttik Does my suggestion work for you?

kynan commented 5 years ago

I've also documented this in the README.

Luttik commented 4 years ago

@kynan I'm sorry I never responded. I think this solved my issue back then. I suppose you can close the issue.