Run mypy from tox

This avoids the need to duplicate our dependency list in multiple places
and allows us to take advantage of tox's dependency management
infrastructure, to ensure we always get the latest and greatest version
of a package allowed by upper-constraints. It also removes the slowest
pre-commit hook (by some distance), making pre-commit faster.

Change-Id: Ie241768231f180d5a672bf9f8fdc6a1eb8d7dfdb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-12-08 18:37:34 +00:00
parent 66bad0b1d9
commit dc31f9fd61
3 changed files with 10 additions and 40 deletions
-35
View File
@@ -58,41 +58,6 @@ repos:
- id: codespell
args: ['--ignore-words=doc/dictionary.txt']
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
additional_dependencies:
- types-paramiko
# keep this in-sync with '[tool.mypy] files' in 'pyproject.toml'
files: |
(?x)(
nova/compute/manager.py
| nova/compute/pci_placement_translator.py
| nova/crypto.py
| nova/filesystem.py
| nova/limit/local.py
| nova/limit/placement.py
| nova/network/neutron.py
| nova/pci
| nova/privsep/path.py
| nova/scheduler/client/report.py
| nova/scheduler/request_filter.py
| nova/scheduler/utils.py
| nova/virt/driver.py
| nova/virt/hardware.py
| nova/virt/libvirt/machine_type_utils.py
| nova/virt/libvirt/__init__.py
| nova/virt/libvirt/cpu/__init__.py
| nova/virt/libvirt/cpu/api.py
| nova/virt/libvirt/cpu/core.py
| nova/virt/libvirt/driver.py
| nova/virt/libvirt/event.py
| nova/virt/libvirt/guest.py
| nova/virt/libvirt/host.py
| nova/virt/libvirt/utils.py
)
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.1
hooks:
-1
View File
@@ -124,7 +124,6 @@ follow_imports = "skip"
incremental = true
check_untyped_defs = true
warn_unused_ignores = true
# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml'
files = [
"nova/compute/manager.py",
"nova/compute/pci_placement_translator.py",
+10 -4
View File
@@ -131,18 +131,24 @@ description =
Run style checks.
deps =
pre-commit
extras =
{[testenv:mypy]deps}
commands =
pre-commit run --all-files --show-diff-on-failure
{[testenv:mypy]commands}
[testenv:mypy]
description =
Run type checks.
# TODO(stephenfin): At some point we might wish to create a 'types' extra
deps =
pre-commit
extras =
mypy
types-decorator
types-paramiko
types-python-dateutil
types-PyYAML
types-setuptools
commands =
pre-commit run --all-files --show-diff-on-failure mypy
mypy
[testenv:autopep8]
extras =