Skip to content

Commit 32ccb6b

Browse files
committed
Bump CI linters and use pre-commit.ci over GHA
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 1bf0bb5 commit 32ccb6b

File tree

6 files changed

+50
-55
lines changed

6 files changed

+50
-55
lines changed

.github/workflows/check.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,22 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
pre-commit:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v1
17-
- uses: actions/setup-python@v1
18-
- uses: pre-commit/[email protected]
19-
2013
test:
21-
name: test ${{ matrix.py }} - ${{ matrix.os }}
22-
runs-on: ${{ matrix.os }}-latest
14+
name: test on CPython ${{ matrix.py }}
15+
runs-on: ubuntu-20.04
2316
strategy:
2417
fail-fast: false
2518
matrix:
26-
os:
27-
- Ubuntu
2819
py:
29-
- 3.10.0-rc.2
20+
- "3.10"
3021
- 3.9
3122
- 3.8
3223
- 3.7
3324
steps:
3425
- name: setup python for tox
3526
uses: actions/setup-python@v2
3627
with:
37-
python-version: 3.10.0-rc.2
28+
python-version: "3.10"
3829
- name: install tox
3930
run: python -m pip install tox
4031
- uses: actions/checkout@v2
@@ -59,23 +50,21 @@ jobs:
5950
DIFF_AGAINST: HEAD
6051

6152
check:
62-
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
63-
runs-on: ${{ matrix.os }}-latest
53+
name: tox env ${{ matrix.tox_env }}
54+
runs-on: ubuntu-20.04
6455
strategy:
6556
fail-fast: false
6657
matrix:
67-
os:
68-
- Ubuntu
6958
tox_env:
7059
- type
7160
- dev
7261
- pkg_check
7362
steps:
7463
- uses: actions/checkout@v2
75-
- name: setup Python 3.10.0-rc.2
64+
- name: setup Python 3.10
7665
uses: actions/setup-python@v2
7766
with:
78-
python-version: 3.10.0-rc.2
67+
python-version: "3.10"
7968
- name: install tox
8069
run: python -m pip install tox
8170
- name: run check for ${{ matrix.tox_env }}
@@ -85,13 +74,13 @@ jobs:
8574

8675
publish:
8776
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
88-
needs: [check, test, pre-commit]
89-
runs-on: ubuntu-latest
77+
needs: [check, test]
78+
runs-on: ubuntu-20.04
9079
steps:
9180
- name: setup python to build package
9281
uses: actions/setup-python@v2
9382
with:
94-
python-version: 3.10.0-rc.2
83+
python-version: "3.10"
9584
- name: install build
9685
run: python -m pip install build
9786
- uses: actions/checkout@v2

.pre-commit-config.yaml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v4.1.0
44
hooks:
5+
- id: check-ast
56
- id: check-builtin-literals
67
- id: check-docstring-first
8+
- id: check-merge-conflict
79
- id: check-yaml
810
- id: check-toml
911
- id: debug-statements
1012
- id: end-of-file-fixer
1113
- id: trailing-whitespace
1214
- repo: https://github.com/asottile/pyupgrade
13-
rev: v2.29.1
15+
rev: v2.30.0
1416
hooks:
1517
- id: pyupgrade
18+
args: [ "--py36-plus" ]
1619
- repo: https://github.com/PyCQA/isort
1720
rev: 5.10.1
1821
hooks:
@@ -21,25 +24,35 @@ repos:
2124
rev: 21.12b0
2225
hooks:
2326
- id: black
24-
args: [--safe]
25-
- repo: https://github.com/asottile/setup-cfg-fmt
26-
rev: v1.20.0
27+
args: [ --safe ]
28+
- repo: https://github.com/asottile/blacken-docs
29+
rev: v1.12.0
2730
hooks:
28-
- id: setup-cfg-fmt
29-
args: ["--max-py-version", "3.10"]
31+
- id: blacken-docs
32+
additional_dependencies: [ black==21.12b0 ]
33+
- repo: https://github.com/pre-commit/pygrep-hooks
34+
rev: v1.9.0
35+
hooks:
36+
- id: rst-backticks
3037
- repo: https://github.com/tox-dev/tox-ini-fmt
3138
rev: "0.5.1"
3239
hooks:
3340
- id: tox-ini-fmt
41+
args: [ "-p", "fix" ]
42+
- repo: https://github.com/asottile/setup-cfg-fmt
43+
rev: v1.20.0
44+
hooks:
45+
- id: setup-cfg-fmt
46+
args: [ --min-py3-version, "3.7", "--max-py-version", "3.10" ]
3447
- repo: https://github.com/PyCQA/flake8
35-
rev: "4.0.1"
48+
rev: 4.0.1
3649
hooks:
3750
- id: flake8
3851
additional_dependencies:
39-
- flake8-bugbear==21.9.2
40-
- flake8-comprehensions==3.7
41-
- flake8-pytest-style==1.5
42-
- flake8-spellcheck==0.24
43-
- flake8-unused-arguments==0.0.7
44-
- flake8-noqa==1.2
45-
- pep8-naming==0.12.1
52+
- flake8-bugbear==21.11.29
53+
- flake8-comprehensions==3.7
54+
- flake8-pytest-style==1.6
55+
- flake8-spellcheck==0.24
56+
- flake8-unused-arguments==0.0.9
57+
- flake8-noqa==1.2.1
58+
- pep8-naming==0.12.1

codecov.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

setup.cfg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ where = src
4949

5050
[options.extras_require]
5151
test =
52-
pytest>=4
53-
pytest-cov>=2.7
52+
pytest>=6
53+
pytest-cov>=3
5454

5555
[options.package_data]
5656
sphinx_argparse_cli = py.typed
@@ -86,7 +86,6 @@ source =
8686
[coverage:run]
8787
branch = true
8888
parallel = true
89-
dynamic_context = test_function
9089
source =
9190
${_COVERAGE_SRC}
9291

src/sphinx_argparse_cli/_logic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def load_sub_parsers(self) -> Iterator[tuple[list[str], str, ArgumentParser]]:
102102
return
103103
parser_to_args: dict[int, list[str]] = defaultdict(list)
104104
str_to_parser: dict[str, ArgumentParser] = {}
105-
sub_parser = cast(_SubParsersAction, top_sub_parser._group_actions[0])
105+
sub_parser: _SubParsersAction[ArgumentParser] = top_sub_parser._group_actions[0] # type: ignore
106106
for key, parser in sub_parser._name_parser_map.items():
107107
parser_to_args[id(parser)].append(key)
108108
str_to_parser[key] = parser

tox.ini

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tox]
22
envlist =
3+
fix
34
py310
45
py39
56
py38
67
py37
7-
fix
88
type
99
pkg_check
1010
isolated_build = true
@@ -34,7 +34,7 @@ description = run static analysis and style check using flake8
3434
passenv =
3535
HOMEPATH
3636
PROGRAMDATA
37-
basepython = python3.9
37+
basepython = python3.10
3838
skip_install = true
3939
deps =
4040
pre-commit>=2
@@ -47,29 +47,29 @@ description = run type check on code base
4747
setenv =
4848
{tty:MYPY_FORCE_COLOR = 1}
4949
deps =
50-
mypy==0.910
50+
mypy==0.930
5151
types-docutils
5252
commands =
53-
mypy --strict --python-version 3.9 src
54-
mypy --strict --python-version 3.9 tests
53+
mypy --strict --python-version 3.10 src
54+
mypy --strict --python-version 3.10 tests
5555

5656
[testenv:pkg_check]
5757
description = check that the long description is valid
5858
passenv =
5959
*
60-
basepython = python3.9
60+
basepython = python3.10
6161
skip_install = true
6262
deps =
63-
build>=0.1
64-
twine>=3.2
63+
build>=0.7
64+
twine>=3.7
6565
changedir = {toxinidir}
6666
commands =
6767
python -m build --sdist --wheel -o {envtmpdir} .
6868
twine check {envtmpdir}/*
6969

7070
[testenv:dev]
7171
description = generate a DEV environment
72-
basepython = python3.9
72+
basepython = python3.10
7373
usedevelop = true
7474
extras =
7575
docs

0 commit comments

Comments
 (0)