Skip to content

Commit f22e3b7

Browse files
pradyunsgnotatallshaw
authored andcommitted
Move type checking outside pre-commit
Invoke mypy with specific directories rather than a list of files found by pre-commit in the repository. This makes it catch more errors and issues.
1 parent 18694f6 commit f22e3b7

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ jobs:
3535
- run: pip install nox
3636
- run: nox -s docs
3737

38+
typecheck:
39+
name: typecheck
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: actions/setup-python@v5
45+
with:
46+
python-version: "3.x"
47+
- run: pip install nox
48+
- run: nox -s typecheck
49+
3850
determine-changes:
3951
runs-on: ubuntu-22.04
4052
outputs:
@@ -252,6 +264,7 @@ jobs:
252264

253265
needs:
254266
- determine-changes
267+
- typecheck
255268
- docs
256269
- packaging
257270
- tests-unix

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ repos:
2828
args: [--fix]
2929

3030
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.16.1
31+
rev: v1.10.0
3232
hooks:
3333
- id: mypy
3434
exclude: tests/data
3535
args: ["--pretty", "--show-error-codes"]
3636
additional_dependencies: [
3737
'keyring==24.2.0',
38-
'nox==2024.03.02',
38+
'nox==2023.4.22',
3939
'pytest',
4040
'types-docutils==0.20.0.3',
4141
'types-setuptools==68.2.0.0',

noxfile.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,29 @@ def docs_live(session: nox.Session) -> None:
174174
)
175175

176176

177+
@nox.session
178+
def typecheck(session: nox.Session) -> None:
179+
session.install(
180+
"mypy",
181+
"keyring",
182+
"nox",
183+
"pytest",
184+
"types-docutils",
185+
"types-setuptools",
186+
"types-freezegun",
187+
"types-pyyaml",
188+
)
189+
190+
session.run(
191+
"mypy",
192+
"src/pip",
193+
"tests",
194+
"tools",
195+
"noxfile.py",
196+
"--exclude=tests/data",
197+
)
198+
199+
177200
@nox.session
178201
def lint(session: nox.Session) -> None:
179202
session.install("pre-commit")

0 commit comments

Comments
 (0)