From 698d8fb387a1e4d386deaa264af24ba1aa04c786 Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler Date: Tue, 13 Dec 2022 11:26:00 +0000 Subject: [PATCH] Add black to lint job And rename tox' "mypy" env to "lint". --- .github/workflows/test.yml | 2 +- dev-requirements.txt | 3 +++ pyproject.toml | 2 ++ tox.ini | 5 +++-- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae9b341e0..b82b462f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: - name: Install packages run: pip install tox - name: Run Tox - run: tox -e mypy,package_readme + run: tox -e lint,package_readme test: runs-on: ${{ matrix.platform }} diff --git a/dev-requirements.txt b/dev-requirements.txt index 73eae6803..a986a1fe7 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -3,3 +3,6 @@ tox>=2.5 bump2version>=0.5.6 sphinx>=1.5.5 mypy>=0.782 + +# Pin black as each version could change formatting, breaking CI randomly. +black==22.12.0 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..5a8e741b0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +target-version = ["py37"] diff --git a/tox.ini b/tox.ini index 0149f3092..3bdbbe703 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.0 -envlist = mypy, py3{7,8,9,10,11}-cov, htmlcov +envlist = lint, py3{7,8,9,10,11}-cov, htmlcov skip_missing_interpreters=true [testenv] @@ -41,11 +41,12 @@ commands = coverage combine coverage html -[testenv:mypy] +[testenv:lint] deps = -r dev-requirements.txt skip_install = true commands = + black --check --diff . mypy [testenv:codecov]