Skip to content

Commit bf1f8eb

Browse files
anselorkmvanbrunt
authored andcommitted
Change mypy and lint github steps to use nox/invoke to make CI validation configuration/commands match developer local commands.
1 parent b94d04a commit bf1f8eb

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install python prerequisites
26-
run: pip install -U --user pip setuptools setuptools-scm flake8
26+
run: pip install -U --user pip setuptools setuptools-scm nox
2727
- name: Lint
28-
run: python -m flake8 .
28+
run: python -m nox --non-interactive --session validate-${{ matrix.python-version }} -k flake8

.github/workflows/mypy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ jobs:
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install python prerequisites
26-
run: pip install -U --user pip setuptools setuptools-scm mypy
26+
run: pip install -U --user pip setuptools setuptools-scm nox
2727
- name: MyPy
28-
run: python -m mypy cmd2
28+
run: python -m nox --non-interactive --session validate-${{ matrix.python-version }} -k mypy # Run nox for mypy

noxfile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,10 @@ def tests(session, plugin):
3939
'--no-pty',
4040
'--append-cov',
4141
)
42+
43+
44+
@nox.session(python=['3.8', '3.9'])
45+
@nox.parametrize('step', ['mypy', 'flake8'])
46+
def validate(session, step):
47+
session.install('invoke', './[validate]')
48+
session.run('invoke', step)

setup.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,24 @@
6666
],
6767
# development only dependencies: install with 'pip install -e .[dev]'
6868
'dev': [
69-
"pytest>=4.6",
7069
'codecov',
70+
'doc8',
71+
'flake8',
72+
'invoke',
73+
'mypy==0.902',
74+
'nox',
75+
"pytest>=4.6",
7176
'pytest-cov',
7277
'pytest-mock',
73-
'nox',
74-
'flake8',
7578
'sphinx',
7679
'sphinx-rtd-theme',
7780
'sphinx-autobuild',
78-
'doc8',
79-
'invoke',
8081
'twine>=1.11',
8182
],
83+
'validate': [
84+
'flake8',
85+
'mypy==0.902',
86+
],
8287
}
8388

8489
PACKAGE_DATA = {

0 commit comments

Comments
 (0)