style: fix black configuration (#46740)

We mostly use `spack style` and `spack style --fix`, but it's nice to also be able to
run plain old `black .` in the repo.

- [x] Fix includes and excludes `pyproject.toml` so that we *only* cover files we expect
  to be blackened.

Note that `spack style` is still likely the better way to go, because it looks at `git
status` and tells black to only check files that changed from `develop`. `black` with
`pyproject.toml` won't do that. Of course, you can always manually specify which files
you want blackened.

Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
Todd Gamblin 2024-10-02 19:22:54 -07:00 committed by GitHub
parent aa53007f82
commit 322a83c808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,17 +70,8 @@ features = [
[tool.black] [tool.black]
line-length = 99 line-length = 99
target-version = ['py36', 'py37', 'py38', 'py39', 'py310'] target-version = ['py36', 'py37', 'py38', 'py39', 'py310']
include = ''' include = '(lib/spack|var/spack/repos)/.*\.pyi?$|bin/spack$'
\.pyi?$ extend-exclude = 'lib/spack/external'
'''
extend-exclude = '''
/(
\.git
| \.mypy_cache
| ^lib/spack/external/
| ^opt/
)/
'''
skip_magic_trailing_comma = true skip_magic_trailing_comma = true
[tool.isort] [tool.isort]