Open behnam opened 6 years ago
Yes, please. We need something nicer than one long regex.
I like this idea. @jgirardet, you could do this on top of your .gitignore support work. What do you think?
A gentle voice from 2021. I love this idea. so we are looking for a pr, right?
When putting
include
/exclude
rules intopyproject.toml
file...1) It's mentally easier to think about each pattern separately and not as a whole regex,
2) Glob/Gitignore-like patterns are easier to read and write, and
3) Using gitignore-like patterns allows easier comparison with the ignore file of the SCM.
Famously,
hg
started with regex patterns for its path patterns, but later enabled glob/gitignore-like patterns. http://hgbook.red-bean.com/read/file-names-and-pattern-matching.htmlCargo already accepts a list of glob/gitignore patterns. https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-exclude-and-include-fields-optional (We're in the middle of transition from glob patterns to gitignore-like ones. More here: https://github.com/rust-lang/cargo/issues/4268)
(Gitignore patterns are a superset of glob patterns, adding a couple of rules on top of glob.)
With that, I like to propose support for gitignore-like (or at least glob) patterns in Black's
include
andexclude
entries inpyproject.toml
.To keep it backwards-compatible, it can so that then the values are string, the old behavior is preserved (at least for now), and if the value is a list, they are treated as gitignore-like patterns, similar to Cargo.
What do you think?