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

Support recursive ** globs in --ignore #112

Open
asmeurer opened this issue Dec 3, 2021 · 3 comments
Open

Support recursive ** globs in --ignore #112

asmeurer opened this issue Dec 3, 2021 · 3 comments

Comments

@asmeurer
Copy link

asmeurer commented Dec 3, 2021

Description / Summary

Currently the --ignore flag supports globs, but doesn't support recursive **-style globs. This makes it hard to ignore directories generated by autosummary.

Value / benefit

I have to come up with a regular expression to emulate this, which is annoying.

Implementation details

I looked at the implementation and it wasn't straightforward to add because the way it is currently implemented it uses fnmatch, and for whatever reason, recursive globs are not supported by fnmatch. They are only supported by glob, which reads the filesystem, but the current implementation uses a function that doesn't read the file system, presumably to be easier to test. Presumably the only reasonable fix here is to use some external fnmatch module that supports recursive globbing (I don't know of one, but presumably something like it exists), or to somehow automatically convert a recursive glob into a regex.

Tasks to complete

No response

@asmeurer asmeurer changed the title Support recursive ** globs with --ignore Support recursive ** globs in --ignore Dec 3, 2021
@cbarrick
Copy link

I ran into this same problem.

Deleting a directory that contains the output of sphinx-autogen/autosummary causes sphinx-autobuild to enter a rebuild loop. One rebuild is triggered per generated file. The solution is to ignore the directory all together.

As an alternative (or in addition) to supporting recursive globs, sphinx-autobuild could ignore the entire directory passed to --ignore, e.g. --ignore=docs/api.

@ianhi
Copy link

ianhi commented Feb 25, 2022

Agree that it would be nice to easily ignore directories with glob. But I got this working using the re-ignore option.:

--re-ignore api.*

stopped the infinite loop

@guideloom
Copy link

I just hit this as well. Really need a way for sphinx-autobuild to ignore a folder and everything underneath it. I have it watching my source folder, and "_build" is a subfolder under that. If someone does a "make html" in the source folder, sphinx-autobuild runs once for EACH file changed/updated under the _build folder. Wish we could do "--ignore _build" or "--ignore _build/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants