Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply nbstripout to all files within a folder recursively #127

Closed
AndrewLouw opened this issue Jun 8, 2020 · 9 comments
Closed

Apply nbstripout to all files within a folder recursively #127

AndrewLouw opened this issue Jun 8, 2020 · 9 comments

Comments

@AndrewLouw
Copy link

It'd be a nice feature to clear outputs recursively in a folder instead of listing all the files when doing this manually
Thanks

@kynan
Copy link
Owner

kynan commented Jun 27, 2020

You can the really easily by just recursively finding all the files you want and pass them to nbstripout:

find . -name *.ipynb -exec nbstripout {} +

I'd prefer to leave functionality for selecting input out of nbstripout.

@kynan kynan removed this from the 0.3.9 milestone Jun 27, 2020
@kynan kynan self-assigned this Apr 11, 2021
@kynan
Copy link
Owner

kynan commented Apr 11, 2021

@AndrewLouw Is that sufficient for your use case? Can we close this?

@AndrewLouw
Copy link
Author

I mean, it works, but I'd still recommend a -r flag to have it built in. There are lots of people out there that don't feel comfortable chaining command line programs together and I don't imagine it'd be a hard feature to add. But it's your project and if you'd rather keep it as a one in one out tool then that's fine with me.

@kynan
Copy link
Owner

kynan commented Apr 12, 2021

nbstripout is not a one-in-one-out tool: you can already specify any number of notebooks on the command line.

Adding a flag for searching directories recursively may sound simple, but it opens up a whole host of other issues nbstripout may need to deal with: what if the next persona wants to exclude certain subdirectories or certain file patterns? I don't want to re-implement functionality for which there are better tools (and find is a much better tool to find files in a particular directory).

If you (or someone else) feels strongly about this feature and wants to implement it I'll happily accept a PR.

For now I feel there are good enough workarounds to make this not a high priority feature. I'll add it to the backlog.

@WolfEYc
Copy link

WolfEYc commented Jun 17, 2024

bump

@kynan
Copy link
Owner

kynan commented Jul 1, 2024

@WolfEYc My position on this has not changed :) I don't consider recursively walking a directory tree nbstripout's responsibility. See previous comments for workarounds. I'm not going to implement this.

@AndrewLouw
Copy link
Author

I was young and naive when I asked for this feature, kynan is right. Using find is the most appropriate way to achieve this. But perhaps an example in the docs would help people out?

kynan added a commit that referenced this issue Jul 2, 2024
…ubdirectories recursively

This was requested in #127.
@kynan
Copy link
Owner

kynan commented Jul 2, 2024

That is a fair request 👍🏽 Done in c6c1067.

@kynan kynan modified the milestones: Backlog, 0.8.0 Nov 3, 2024
@kynan kynan changed the title please add -r flag Apply nbstripout to all files within a folder recursively Nov 3, 2024
@kynan kynan self-assigned this Nov 3, 2024
@kynan
Copy link
Owner

kynan commented Nov 3, 2024

I'm calling this done, please reopen if you feel anything else is needed here.

@kynan kynan closed this as completed Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants