diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec49b3c6..de636bfb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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 diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index a29184f0..00000000 --- a/.isort.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[settings] -profile = black -multi_line_output = 3 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ef72dcf1..bb3e8181 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..88c97f1d --- /dev/null +++ b/pyproject.toml @@ -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" diff --git a/setup.cfg b/setup.cfg index 90325e8a..55c5316c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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/ diff --git a/tox.ini b/tox.ini index 55052a02..c58f8795 100644 --- a/tox.ini +++ b/tox.ini @@ -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 = @@ -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 =