All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 # Example configuration for Black.
3 # NOTE: you have to use single-quoted strings in TOML for regular expressions.
4 # It's the equivalent of r-strings in Python. Multiline strings are treated as
5 # verbose regular expressions by Black. Use [ ] to denote a significant space
10 target-version = ['py37', 'py38']
14 # The following are specific to Black, you probably don't want those.
20 # We use preview style for formatting Black itself. If you
21 # want stable formatting across releases, you should keep
25 # Build system information and other project-specific configuration below.
26 # NOTE: You don't need this in your own Black configuration.
29 requires = ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"]
30 build-backend = "hatchling.build"
34 description = "The uncompromising code formatter."
36 requires-python = ">=3.7"
38 { name = "Łukasz Langa", email = "lukasz@langa.pl" },
50 "Development Status :: 5 - Production/Stable",
51 "Environment :: Console",
52 "Intended Audience :: Developers",
53 "License :: OSI Approved :: MIT License",
54 "Operating System :: OS Independent",
55 "Programming Language :: Python",
56 "Programming Language :: Python :: 3 :: Only",
57 "Programming Language :: Python :: 3.7",
58 "Programming Language :: Python :: 3.8",
59 "Programming Language :: Python :: 3.9",
60 "Programming Language :: Python :: 3.10",
61 "Programming Language :: Python :: 3.11",
62 "Topic :: Software Development :: Libraries :: Python Modules",
63 "Topic :: Software Development :: Quality Assurance",
67 "mypy_extensions>=0.4.3",
70 "tomli>=1.1.0; python_full_version < '3.11.0a7'",
71 "typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'",
72 "typing_extensions>=3.10.0.0; python_version < '3.10'",
74 dynamic = ["readme", "version"]
76 [project.optional-dependencies]
77 colorama = ["colorama>=0.4.3"]
78 uvloop = ["uvloop>=0.15.2"]
88 black = "black:patched_main"
89 blackd = "blackd:patched_main [d]"
92 Changelog = "https://github.com/psf/black/blob/main/CHANGES.md"
93 Homepage = "https://github.com/psf/black"
95 [tool.hatch.metadata.hooks.fancy-pypi-readme]
96 content-type = "text/markdown"
98 { path = "README.md" },
99 { path = "CHANGES.md" },
105 [tool.hatch.build.hooks.vcs]
106 version-file = "src/_black_version.py"
108 version = "{version}"
111 [tool.hatch.build.targets.sdist]
112 exclude = ["/profiling"]
114 [tool.hatch.build.targets.wheel]
115 only-include = ["src"]
118 [tool.hatch.build.targets.wheel.hooks.mypyc]
119 enable-by-default = false
121 "hatch-mypyc>=0.13.0",
123 # Required stubs to be removed when the packages support PEP 561 themselves
124 "types-typed-ast>=1.4.2",
126 require-runtime-dependencies = true
128 # There's no good reason for blackd to be compiled.
130 # Not performance sensitive, so save bytes + compilation time:
131 "/src/blib2to3/__init__.py",
132 "/src/blib2to3/pgen2/__init__.py",
133 "/src/black/output.py",
134 "/src/black/concurrency.py",
135 "/src/black/files.py",
136 "/src/black/report.py",
137 # Breaks the test suite when compiled (and is also useless):
138 "/src/black/debug.py",
139 # Compiled modules can't be run directly and that's a problem here:
140 "/src/black/__main__.py",
142 options = { debug_level = "0" }
146 # So these are the environments we target:
147 # - Python: CPython 3.7+ only
148 # - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64
149 # - OS: Linux (no musl), Windows, and macOS
151 skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp-*"]
152 # This is the bare minimum needed to run the test suite. Pulling in the full
153 # test_requirements.txt would download a bunch of other packages not necessary
154 # here and would slow down the testing step a fair bit.
155 test-requires = ["pytest>=6.1.1"]
156 test-command = 'pytest {project} -k "not incompatible_with_mypyc"'
157 test-extras = ["d"," jupyter"]
158 # Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't
160 test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"]
162 [tool.cibuildwheel.environment]
163 HATCH_BUILD_HOOKS_ENABLE = "1"
164 MYPYC_OPT_LEVEL = "3"
165 MYPYC_DEBUG_LEVEL = "0"
166 # CPython 3.11 wheels aren't available for aiohttp and building a Cython extension
167 # from source also doesn't work.
168 AIOHTTP_NO_EXTENSIONS = "1"
170 [tool.cibuildwheel.linux]
172 "yum install -y clang gcc",
175 [tool.cibuildwheel.linux.environment]
176 HATCH_BUILD_HOOKS_ENABLE = "1"
177 MYPYC_OPT_LEVEL = "3"
178 MYPYC_DEBUG_LEVEL = "0"
179 # Black needs Clang to compile successfully on Linux.
181 AIOHTTP_NO_EXTENSIONS = "1"
187 skip_gitignore = true
188 skip_glob = ["src/blib2to3", "tests/data", "profiling"]
189 known_first_party = ["black", "blib2to3", "blackd", "_black_version"]
191 [tool.pytest.ini_options]
192 # Option below requires `tests/optional.py`
193 addopts = "--strict-config --strict-markers"
195 "no_blackd: run when `d` extra NOT installed",
196 "no_jupyter: run when `jupyter` extra NOT installed",
199 "incompatible_with_mypyc: run when testing mypyc compiled black"
204 # this is mitigated by a try/catch in https://github.com/psf/black/pull/2974/
205 # this ignore can be removed when support for aiohttp 3.7 is dropped.
206 '''ignore:Decorator `@unittest_run_loop` is no longer needed in aiohttp 3\.8\+:DeprecationWarning''',
207 # this is mitigated by a try/catch in https://github.com/psf/black/pull/3198/
208 # this ignore can be removed when support for aiohttp 3.x is dropped.
209 '''ignore:Middleware decorator is deprecated since 4\.0 and its behaviour is default, you can simply remove this decorator:DeprecationWarning''',
210 # this is mitigated by https://github.com/python/cpython/issues/79071 in python 3.8+
211 # this ignore can be removed when support for 3.7 is dropped.
212 '''ignore:Bare functions are deprecated, use async ones:DeprecationWarning''',
213 # aiohttp is using deprecated cgi modules - Safe to remove when fixed:
214 # https://github.com/aio-libs/aiohttp/issues/6905
215 '''ignore:'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning''',