pyproject: narrow the range of files processed by `black`
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 17 Dec 2024 21:58:51 -0500
changeset 52543 1dea9d91f476
parent 52542 8986a3a8147a
child 52544 7091b39adc65
pyproject: narrow the range of files processed by `black` I initially started looking at this, hoping to coax `hg fix` to read this, so it doesn't require manually setting something in `.hg/hgrc`. Also I noticed that it takes ~30s to run `hg fix` on a commit that is only adding all of the `*.pyi` files generated by pytype. That seems to be an issue with the extension itself, as updating the `exclude` list here didn't have much affect on the time it takes. That said, a simple command line run of `black`, which is what d4c8b4b90ecb was trying to allow, was reformatting the `cext/*.pyi` files, which seems undesirable. So we kill that off by including only `*.py` files, and also throw a few directories into the `exclude` list that are in my local `hg st -i` list, because we never want to process them. This saves a few seconds running `black` on the command line.
pyproject.toml
--- a/pyproject.toml	Tue Dec 17 19:21:15 2024 -0500
+++ b/pyproject.toml	Tue Dec 17 21:58:51 2024 -0500
@@ -40,14 +40,18 @@
 
 [tool.black]
 line-length = 80
+include = '\.py$'
 exclude = '''
 build/
 | wheelhouse/
 | dist/
 | packages/
+| __pycache__/
+| \.pytype/
 | \.hg/
 | \.mypy_cache/
 | \.venv/
+| mercurial/locale/
 | mercurial/thirdparty/
 '''
 skip-string-normalization = true