Skip to content

--include= and --exclude= #270

@ambv

Description

@ambv

I always steered people towards find | grep -E | grep -Ev | xargs black to do custom file matching. But that doesn't work on Windows. We need support for --include= and --exclude= within Black.

They hold regular expressions. The former is "what gets included on recursive searches", the latter "what gets dropped on recursive searches". You can pass multiple --include and multiple --exclude. Checks for --exclude are done first, checks for --include later.

--include= would have a default that is now stores in PYTHON_EXTENSIONS (".pyi?$" in regex form)
--exclude= would have a default that is now stored in BLACKLISTED_DIRECTORIES

This functionality is required by pypa/pip#5425.

Metadata

Metadata

Assignees

Labels

T: enhancementNew feature or requestT: styleWhat do we want Blackened code to look like?

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions