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

[RFE] Support gitignore-like include/exclude patterns #541

Open
behnam opened this issue Sep 29, 2018 · 3 comments
Open

[RFE] Support gitignore-like include/exclude patterns #541

behnam opened this issue Sep 29, 2018 · 3 comments
Labels
C: configuration CLI and configuration

Comments

@behnam
Copy link

behnam commented Sep 29, 2018

When putting include/exclude rules into pyproject.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.html

Cargo 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: rust-lang/cargo#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 and exclude entries in pyproject.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?

@ghost
Copy link

ghost commented Jun 2, 2019

Yes, please. We need something nicer than one long regex.

@ambv
Copy link
Collaborator

ambv commented Mar 3, 2020

I like this idea. @jgirardet, you could do this on top of your .gitignore support work. What do you think?

@wasdee
Copy link

wasdee commented Jan 27, 2021

A gentle voice from 2021. I love this idea. so we are looking for a pr, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: configuration CLI and configuration
Projects
None yet
Development

No branches or pull requests

4 participants