Skip to content

Commit

Permalink
cleanup tools configuration
Browse files Browse the repository at this point in the history
* move to pyproject.toml when possible
* use pre-commit in tox, don't duplicate configuration
* don't run mypy in pre-commit
* update flake8, mypy and isort
* update github actions
  • Loading branch information
kmike committed Jul 12, 2023
1 parent a3f3e15 commit be25b79
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 73 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
toxenv: provider

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -59,12 +59,12 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.11"]
tox-job: ["mypy", "flake8", "twine-check"]
tox-job: ["mypy", "linters", "twine-check"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
3 changes: 0 additions & 3 deletions .isort.cfg

This file was deleted.

22 changes: 8 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
repos:
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: 22.3.0
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3.8
additional_dependencies:
- click<8.1
- repo: https://github.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: 6.0.0
hooks:
- id: mypy
- id: flake8
additional_dependencies:
- types-setuptools
args: [--check-untyped-defs, --ignore-missing-imports, --no-warn-no-return]
- flake8-docstrings
- flake8-print
20 changes: 20 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tool.isort]
profile = "black"
multi_line_output = 3

[tool.mypy]
#check_untyped_defs = true
ignore_missing_imports = true
no_warn_no_return = true
files = [
"scrapy_zyte_api",
"tests"
]

[tool.pytest.ini_options]
junit_family = "xunit2"
testpaths = [
"scrapy_zyte_api/",
"tests/"
]
minversion = "6.0"
8 changes: 0 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,3 @@ max-complexity = 18
select = B,C,E,F,W,T4
per-file-ignores =
tests/test_providers.py: E402

[mypy]
files=scrapy_zyte_api,tests
ignore_missing_imports=true

[tool:pytest]
junit_family=xunit2
testpaths=scrapy_zyte_api/ tests/
49 changes: 6 additions & 43 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37,py38,py39,py310,py311,mypy,isort,black,flake8
envlist = py37,py38,py39,py310,py311,mypy,linters,twine-check

[testenv]
deps =
Expand Down Expand Up @@ -82,51 +82,14 @@ extras = provider

[testenv:mypy]
deps =
mypy==0.991
mypy==1.4.1
types-setuptools

commands = mypy --check-untyped-defs --ignore-missing-imports --no-warn-no-return scrapy_zyte_api tests
commands = mypy scrapy_zyte_api tests

[testenv:flake8]
deps =
flake8
flake8-docstrings
flake8-print>=3.0.1
commands =
flake8 \
scrapy_zyte_api \
setup.py \
tests \
{posargs}

[testenv:black]
deps =
black
commands =
black \
scrapy_zyte_api \
setup.py \
tests/ \
{posargs}

[testenv:black-check]
deps =
{[testenv:black]deps}
commands =
{[testenv:black]commands} --diff

[testenv:isort]
deps = isort
commands =
isort \
scrapy_zyte_api/ \
setup.py \
tests/ \
{posargs}

[testenv:isort-check]
deps = {[testenv:isort]deps}
commands = {[testenv:isort]commands} -c
[testenv:linters]
deps = -rrequirements-dev.txt
commands = pre-commit run --all-files --show-diff-on-failure

[testenv:twine-check]
deps =
Expand Down

0 comments on commit be25b79

Please sign in to comment.