diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml new file mode 100644 index 0000000..6b37756 --- /dev/null +++ b/.github/workflows/formatter.yml @@ -0,0 +1,23 @@ +name: Python Formatter (isort & black) + +on: + pull_request: + branches: [main] + +jobs: + formatting: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + - name: Install isort and black + run: | + python -m pip install --upgrade pip + pip install isort black + - name: Run isort and black + run: | + isort -c . + black --check . diff --git a/pyproject.toml b/pyproject.toml index 01a2b9a..d78f6bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,11 @@ [build-system] requires = ["setuptools>=67.0"] build-backend = "setuptools.build_meta" + +[tool.isort] +line_length = 120 +multi_line_output = 1 +include_trailing_comma = true + +[tool.black] +line_length = 120