From 1ad8e497917a7b6c282b700832b06cd466b0af62 Mon Sep 17 00:00:00 2001
From: Thorsten Hater <24411438+thorstenhater@users.noreply.github.com>
Date: Tue, 20 Sep 2022 11:27:10 +0200
Subject: [PATCH] Add black config to pyproject.toml. (#1971)

---
 .github/workflows/lint.yml   | 2 +-
 doc/contrib/coding-style.rst | 2 +-
 pyproject.toml               | 6 ++++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index fa6dbd62..42d61bb2 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -26,7 +26,7 @@ jobs:
       - name: Python Formatting
         uses: psf/black@stable
         with:
-          options: --check --extend-exclude '/(ext|doc/scripts/.*_theme|doc/scripts/inputs.py)'
+          options: --check
           src: scripts/build-catalogue.in .
       - name: Python analysis
         run: |
diff --git a/doc/contrib/coding-style.rst b/doc/contrib/coding-style.rst
index 4283138b..7558f061 100644
--- a/doc/contrib/coding-style.rst
+++ b/doc/contrib/coding-style.rst
@@ -15,7 +15,7 @@ run the following commands to apply it:
    # Install the formatter if not present
    pip install black
    # Automatically apply style. If unsure what this does read on.
-   black --extend-exclude '/(ext|doc/scripts/.*_theme)' . scripts/build-catalogue.in
+   black . scripts/build-catalogue.in
 
 The formatter can also be run with ``--check`` to list offending files and
 ``--diff`` to preview changes. Most editors can `integrate with black
diff --git a/pyproject.toml b/pyproject.toml
index 0d732541..cd9e92e2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -26,6 +26,12 @@ dependencies = [
     "numpy"
 ]
 
+[tool.black]
+line-length = 88
+target-version = ['py37', 'py38', 'py39', 'py310']
+include = '\.pyi?$'
+extend-exclude='^/(ext|doc/scripts/.*_theme|doc/scripts/inputs.py)'
+
 [tool.setuptools]
 py-modules = ["arbor"]
 
-- 
GitLab