Debian Codegraph @

pyproject.toml

raw ◀ ▶
1 Debian patch touch this file
1 # Example configuration for Black.
2
3 # NOTE: you have to use single-quoted strings in TOML for regular expressions.
4 # It's the equivalent of r-strings in Python.
5 # Multiline strings are treated as verbose regular expressions by Black.
6 # Use [ ] to denote a significant space character.
7
8 [tool.black]
9 line-length = 88
10 target-version = ["py310"]
11 include = '\.pyi?$'
12 extend-exclude = '''
13 /(
14 # The following are specific to Black, you probably don't want those.
15 tests/data/
16 | profiling/
17 )
18 '''
19 # We use the unstable style for formatting Black itself. If you
20 # want bug-free formatting, you should keep this off. If you want
21 # stable formatting across releases, you should also keep `preview = true`
22 # (which is implied by this flag) off.
23 unstable = true
24
25 # Build system information and other project-specific configuration below.
26 # NOTE: You don't need this in your own Black configuration.
27
28 [build-system]
29 requires = ["hatch-fancy-pypi-readme", "hatch-vcs>=0.3.0", "hatchling>=1.27.0"]
30 build-backend = "hatchling.build"
31
32 [project]
33 name = "black"
34 description = "The uncompromising code formatter."
35 license = "MIT"
36 license-files = ["LICENSE"]
37 requires-python = ">=3.10"
38 authors = [{ name = "Łukasz Langa", email = "[email protected]" }]
39 keywords = ["automation", "autopep8", "formatter", "gofmt", "pyfmt", "rustfmt", "yapf"]
40 classifiers = [
41 "Development Status :: 5 - Production/Stable",
42 "Environment :: Console",
43 "Intended Audience :: Developers",
44 "Operating System :: OS Independent",
45 "Programming Language :: Python",
46 "Programming Language :: Python :: 3 :: Only",
47 "Programming Language :: Python :: 3.10",
48 "Programming Language :: Python :: 3.11",
49 "Programming Language :: Python :: 3.12",
50 "Programming Language :: Python :: 3.13",
51 "Programming Language :: Python :: 3.14",
52 "Programming Language :: Python :: 3.15",
53 "Topic :: Software Development :: Libraries :: Python Modules",
54 "Topic :: Software Development :: Quality Assurance",
55 ]
56 dependencies = [
57 "click>=8.0.0",
58 "mypy-extensions>=0.4.3",
59 "packaging>=22.0",
60 "pathspec>=1.0.0",
61 "platformdirs>=2",
62 "pytokens~=0.4.0",
63 "tomli>=1.1.0; python_version<'3.11'",
64 "typing-extensions>=4.0.1; python_version<'3.11'",
65 ]
66 dynamic = ["readme", "version"]
67
68 [project.optional-dependencies]
69 colorama = ["colorama>=0.4.3"]
70 uvloop = [
71 "uvloop>=0.15.2; sys_platform != 'win32'",
72 "winloop>=0.5.0; sys_platform == 'win32'"
73 ]
74 d = ["aiohttp>=3.10"]
75 jupyter = ["ipython>=7.8.0", "tokenize-rt>=3.2.0"]
76
77 [dependency-groups]
78 hatch = ["hatch==1.15.1", "hatch-fancy-pypi-readme", "hatch-vcs", "virtualenv<21.0.0"]
79 cibw = ["cibuildwheel==3.4.0", "pypyp"]
80 pyinstaller = ["pyinstaller"]
81
82 dev = [{ include-group = "cov-tests" }, { include-group = "tox" }, "pre-commit"]
83 cov-tests = [
84 { include-group = "coverage" },
85 { include-group = "tests" },
86 "pytest-cov>=4.1.0",
87 ]
88 docs = [
89 "docutils==0.22.4",
90 "furo==2025.12.19",
91 "myst-parser==5.0.0",
92 "sphinx-copybutton==0.5.2",
93 "sphinx==9.1.0",
94 "sphinxcontrib-programoutput==0.19",
95 ]
96
97 tox = ["tox>=4.22"]
98 tests = ["pytest>=7", "pytest-xdist>=3.0.2"]
99 coverage = ["coverage>=5.3"]
100
101 fuzz = [{ include-group = "coverage" }, "hypothesis", "hypothesmith"]
102 diff-shades = [
103 "diff-shades @ https://github.com/ichard26/diff-shades/archive/stable.zip",
104 ]
105 diff-shades-comment = ["click>=8.1.7", "packaging>=22.0", "urllib3"]
106
107 width-table = ["wcwidth==0.2.14"]
108
109 [project.scripts]
110 black = "black:patched_main"
111 blackd = "blackd:patched_main [d]"
112
113 [project.entry-points."validate_pyproject.tool_schema"]
114 black = "black.schema:get_schema"
115
116 [project.urls]
117 Documentation = "https://black.readthedocs.io/"
118 Changelog = "https://github.com/psf/black/blob/main/CHANGES.md"
119 Repository = "https://github.com/psf/black"
120 Issues = "https://github.com/psf/black/issues"
121
122 [tool.hatch.metadata.hooks.fancy-pypi-readme]
123 content-type = "text/markdown"
124 fragments = [{ path = "README.md" }, { path = "CHANGES.md" }]
125
126 [tool.hatch.version]
127 source = "vcs"
128
129 [tool.hatch.build.hooks.vcs]
130 version-file = "src/_black_version.py"
131 template = """
132 version = "{version}"
133 """
134
135 [tool.hatch.build.targets.sdist]
136 exclude = ["/profiling"]
137
138 [tool.hatch.build.targets.wheel]
139 only-include = ["src"]
140 sources = ["src"]
141 # Note that we change the behaviour of this flag below
142 macos-max-compat = true
143
144 [tool.hatch.build.targets.wheel.hooks.mypyc]
145 enable-by-default = false
146 dependencies = ["hatch-mypyc>=0.16.0", "mypy==1.20.2"]
147 require-runtime-dependencies = true
148 exclude = [
149 # There's no good reason for blackd to be compiled.
150 "/src/blackd",
151 # Not performance sensitive, so save bytes + compilation time:
152 "/src/blib2to3/__init__.py",
153 "/src/blib2to3/pgen2/__init__.py",
154 "/src/black/output.py",
155 "/src/black/concurrency.py",
156 "/src/black/files.py",
157 "/src/black/report.py",
158 # Breaks the test suite when compiled (and is also useless):
159 "/src/black/debug.py",
160 # Compiled modules can't be run directly and that's a problem here:
161 "/src/black/__main__.py",
162 ]
163 mypy-args = ["--ignore-missing-imports"]
•164 options = { debug_level = "2", verbose = true }
165
166 [tool.cibuildwheel]
167 build-verbosity = 1
168
169 # So these are the environments we target:
170 # - Python: CPython 3.10+ only
171 # - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64
172 # - OS: Linux (no musl), Windows, and macOS
173 build = "cp31*"
174 skip = [
175 "*-manylinux_i686",
176 "*-musllinux_*",
177 "*-win32",
178 "pp*",
179 "cp31?t-*", # mypyc doesn't have great support for free threaded builds
180 ]
181
182 test-groups = ["tests"]
183 test-command = 'pytest {project} -k "not incompatible_with_mypyc" -n auto'
184 test-extras = ["d", " jupyter"]
185 # Skip trying to test arm64 builds on Intel Macs. (so cross-compilation doesn't
186 # straight up crash)
187 test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"]
188
189 [tool.cibuildwheel.environment]
190 HATCH_BUILD_HOOKS_ENABLE = "1"
191 MYPYC_OPT_LEVEL = "3"
192 MYPYC_DEBUG_LEVEL = "0"
193 CC = "clang"
194
195 [tool.cibuildwheel.linux]
196 manylinux-x86_64-image = "manylinux_2_28"
197 before-build = ["yum install -y clang"]
198
199 [tool.isort]
200 atomic = true
201 profile = "black"
202 line_length = 88
203 skip_gitignore = true
204 skip_glob = ["tests/data", "profiling"]
205 known_first_party = ["black", "blib2to3", "blackd", "_black_version"]
206
207 [tool.pytest.ini_options]
208 # Option below requires `tests/optional.py`
209 addopts = "--strict-config --strict-markers"
210 optional-tests = [
211 "no_blackd: run when `d` extra NOT installed",
212 "no_jupyter: run when `jupyter` extra NOT installed",
213 ]
214 markers = ["incompatible_with_mypyc: run when testing mypyc compiled black"]
215 xfail_strict = true
216 filterwarnings = ["error"]
217 [tool.coverage.report]
218 omit = ["src/blib2to3/*", "tests/data/*", "*/site-packages/*", ".tox/*"]
219 [tool.coverage.run]
220 relative_files = true
221 branch = true
222
223 [tool.mypy]
224 # Specify the target platform details in config, so your developers are
225 # free to run mypy on Windows, Linux, or macOS and get consistent
226 # results.
227 python_version = "3.10"
228 mypy_path = "src"
229 strict = true
230 strict_bytes = true
231 local_partial_types = true
232 # Unreachable blocks have been an issue when compiling mypyc, let's try to avoid 'em in the first place.
233 warn_unreachable = true
234 implicit_reexport = true
235 show_error_codes = true
236 show_column_numbers = true
237
238 [[tool.mypy.overrides]]
239 module = ["pathspec.*", "IPython.*", "colorama.*", "tokenize_rt.*", "uvloop.*"]
240 ignore_missing_imports = true
241
242 # CI only checks src/, but in case users are running LSP or similar we explicitly ignore
243 # errors in test data files.
244 [[tool.mypy.overrides]]
245 module = ["tests.data.*"]
246 ignore_errors = true