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

Can I configure black to ignore specific directories, such as venv #286

Closed
Mariatta opened this issue Jun 1, 2018 · 3 comments
Closed

Comments

@Mariatta
Copy link
Contributor

Mariatta commented Jun 1, 2018

For example I want to be able to do:
black . --exclude=venv

to format everything, but ignore things under ./venv

Or is this possible already, but I didn't know how yet?

Thanks.

@jgirardet
Copy link
Contributor

#281

@Mariatta
Copy link
Contributor Author

Mariatta commented Jun 1, 2018

Great! Thanks @jgirardet exactly what I need :) (just waiting for it to be in PyPI now ..)

@marcospgp
Copy link

For those like me coming from google:

  --exclude TEXT                  A regular expression that matches files and
                                  directories that should be excluded on
                                  recursive searches. An empty value means no
                                  paths are excluded. Use forward slashes for
                                  directories on all platforms (Windows, too).
                                  By default, Black also ignores all paths
                                  listed in .gitignore. Changing this value
                                  will override all default exclusions.
                                  [default: /(\.direnv|\.eggs|\.git|\.hg|\.ipy
                                  nb_checkpoints|\.mypy_cache|\.nox|\.pytest_c
                                  ache|\.ruff_cache|\.tox|\.svn|\.venv|\.vscod
                                  e|__pypackages__|_build|buck-
                                  out|build|dist|venv)/]
  --extend-exclude TEXT           Like --exclude, but adds additional files
                                  and directories on top of the default values
                                  instead of overriding them.
  --force-exclude TEXT            Like --exclude, but files and directories
                                  matching this regex will be excluded even
                                  when they are passed explicitly as
                                  arguments. This is useful when invoking
                                  Black programmatically on changed files,
                                  such as in a pre-commit hook or editor
                                  plugin.

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

No branches or pull requests

3 participants