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.

Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I3011f918ebcb0d25c80f40d6a95025bb97f4e6b5
This commit is contained in:
Stephen Finucane
2025-12-01 12:59:07 +00:00
parent 1b97a87e00
commit bbb2ed1495
3 changed files with 16 additions and 24 deletions

View File

@@ -13,7 +13,7 @@ repos:
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.4
rev: v0.14.7
hooks:
- id: ruff-check
args: ['--fix', '--unsafe-fixes']
@@ -24,17 +24,3 @@ repos:
- id: hacking
additional_dependencies: []
exclude: '^(doc|releasenotes)/.*$'
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.0
hooks:
- id: mypy
additional_dependencies:
- Sphinx
- types-docutils
# keep this in-sync with '[mypy] exclude' in 'pyproject.toml'
exclude: |
(?x)(
doc/.*
| examples/.*
| releasenotes/.*
)

View File

@@ -50,14 +50,9 @@ packages = [
python_version = "3.10"
show_column_numbers = true
show_error_context = true
ignore_missing_imports = true
strict = true
# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml'
exclude = '''(?x)(
doc
| examples
| releasenotes
)'''
ignore_missing_imports = true
exclude = '(?x)(doc | examples | releasenotes)'
[[tool.mypy.overrides]]
module = ["stevedore.tests.*"]

15
tox.ini
View File

@@ -19,12 +19,23 @@ commands = {posargs}
[testenv:pep8]
description =
Run style checks.
skip_install = true
Run style checks.
deps =
pre-commit
{[testenv:mypy]deps}
commands =
pre-commit run -a
{[testenv:mypy]commands}
[testenv:mypy]
description =
Run type checks.
deps =
{[testenv]deps}
mypy
types-docutils
commands =
mypy --cache-dir="{envdir}/mypy_cache" {posargs:stevedore}
[testenv:docs]
deps =