-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Infra: Fix non-PEP txt files being included and erroring out the build #2405
Conversation
I am -1 on this; whilst a nice idea I think it overcomplicates this list massively for a edge-case. If glob syntax is supported, why not just add A |
The cited example and the stopgap fix is one specific case, but the actual problem @ericsnowcurrently describes in #2404 is general: any Adding I'm not sure I see how adding a handful of globs to an exclude list, while eliminating many of the existing special cases in the process (and avoid having to add an unbounded number more in the future), "massively" increases complexity. Since it as confirmed per my testing, it effectively eliminates any chance of a false negative while producing no false positives, and no more |
The list does not get much longer, but it is really hard (at least for me) to mentally parse what the patterns are meant to be matching or not matching -- the approach I took in 2415 has more code "behind the veil", but keeps So not complexity in terms of what is actually written, but complexity in terms of having to spend several minutes understanding what is going on with the patterns. A |
Yeah, I can certainly see how it could be confusing, but I could just explain it more clearly in the code comments. However, I'd be okay with your revised approach in #2415 provided it is actively planned to be upstreamed in Sphinx, because otherwise it adds way more complexity we have to maintain indefinitely than a few exclude patterns here. |
4e93e21
to
09f4ed3
Compare
09f4ed3
to
825b2b0
Compare
Looks like closing PRs with other PRs is working again; it wasn't for a time. |
Presently, as described in #2404 , Sphinx attempts to render any
.txt
files not explicitly excluded inexclude_patterns
ofconf.py
, in the root or any subdirectories. This results in build failure if any are found, particularly in untracked files which we don't control (e.g.vendor.txt
in venvs).Per the Sphinx docs we can use full Unix shell-style glob syntax, so adding the glob
**/*.txt
toexclude_patterns
neatly fixes most instance of this problem by ensuring that.txt
files are not matched unless they are in the root directory (as all the valid PEPs are).To handle any remaining cases, i.e. non-PEP
.txt
files that are in the root directory and not explicitly excluded, adding*[!0-9].txt
,*[!0-9]?.txt
,*[!0-9]??.txt
,*[!0-9]???.txt
,*[!p]?????.txt
,*[!e]??????.txt
, and*[!p]???????.txt
ensures that to be included,.txt
files must match the equivalent of the regex^pep?[0-9]{4}\.txt$
, which is only used for PEPs.This solution was tested on some sample files in the root and subdirectories, including the reported
venv-spam/vendor.txt
, and several with varying degrees of names somewhat similar to PEPs, and it excluded all of them, while not excluding any valid PEPs.It also obviates the need for some of our other explicit excludes, but I opted to leave them for now
Fix #2404