File tree Expand file tree Collapse file tree
docs/usage_and_configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -513,6 +513,11 @@ As the file extension suggests, `pyproject.toml` is a
513513different tools. _ Black_ is using the ` [tool.black] ` section. The option keys are the
514514same as long names of options on the command line.
515515
516+ Most command-line options can be configured in ` [tool.black] ` by using their long name
517+ without the leading ` -- ` (for example, ` --line-length ` becomes ` line-length ` ). Options
518+ that cannot be configured in ` pyproject.toml ` are called out explicitly in the option
519+ reference above.
520+
516521Note that you have to use single-quoted strings in TOML for regular expressions. It's
517522the equivalent of r-strings in Python. Multiline strings are treated as verbose regular
518523expressions by Black. Use ` [ ] ` to denote a significant space character.
@@ -538,6 +543,38 @@ extend-exclude = '''
538543
539544</details >
540545
546+ <details >
547+ <summary >More complete <code >pyproject.toml</code > template</summary >
548+
549+ ``` toml
550+ [tool .black ]
551+ line-length = 88
552+ target-version = [" py311" ]
553+ required-version = " 26"
554+ include = ' \.pyi?$'
555+
556+ # Formatting behavior
557+ skip-string-normalization = false
558+ skip-magic-trailing-comma = false
559+ preview = false
560+ unstable = false
561+
562+ # File collection
563+ extend-exclude = '''
564+ (
565+ ^/foo.py
566+ | .*_pb2.py
567+ )
568+ '''
569+ force-exclude = '''
570+ (
571+ ^/generated/
572+ )
573+ '''
574+ ```
575+
576+ </details >
577+
541578### Lookup hierarchy
542579
543580Command-line options have defaults that you can see in ` --help ` . A ` pyproject.toml ` can
You can’t perform that action at this time.
0 commit comments