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: I3249b2f7dfa1bf35707d4953fb99b54bdfbaec1b Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
---
|
||||
default_language_version:
|
||||
# force all unspecified python hooks to run python3
|
||||
python: python3
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v6.0.0
|
||||
@@ -22,30 +19,14 @@ repos:
|
||||
hooks:
|
||||
- id: doc8
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.14.3
|
||||
rev: v0.14.8
|
||||
hooks:
|
||||
- id: ruff-check
|
||||
args: ['--fix', '--unsafe-fixes']
|
||||
- id: ruff-format
|
||||
- repo: https://opendev.org/openstack/hacking
|
||||
rev: 7.0.0
|
||||
rev: 8.0.0
|
||||
hooks:
|
||||
- id: hacking
|
||||
additional_dependencies:
|
||||
- flake8-import-order~=0.18.2
|
||||
exclude: '^(doc|releasenotes|tools)/.*$'
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.18.2
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies:
|
||||
- cliff
|
||||
- keystoneauth1
|
||||
- types-requests
|
||||
# keep this in-sync with '[mypy] exclude' in 'setup.cfg'
|
||||
exclude: |
|
||||
(?x)(
|
||||
doc/.*
|
||||
| examples/.*
|
||||
| releasenotes/.*
|
||||
)
|
||||
additional_dependencies: []
|
||||
exclude: '^(doc|releasenotes)/.*$'
|
||||
|
||||
@@ -49,14 +49,7 @@ show_error_context = true
|
||||
# evolving right now
|
||||
warn_unused_ignores = false
|
||||
strict = true
|
||||
# keep this in-sync with 'mypy.exclude' in '.pre-commit-config.yaml'
|
||||
exclude = '''
|
||||
(?x)(
|
||||
doc
|
||||
| examples
|
||||
| releasenotes
|
||||
)
|
||||
'''
|
||||
exclude = '(?x)(doc | releasenotes)'
|
||||
|
||||
[[tool.mypy.overrides]]
|
||||
module = ["osc_lib.tests.*"]
|
||||
|
||||
12
tox.ini
12
tox.ini
@@ -27,8 +27,20 @@ description =
|
||||
Run style checks.
|
||||
deps =
|
||||
pre-commit
|
||||
{[testenv:mypy]deps}
|
||||
commands =
|
||||
pre-commit run --all-files --show-diff-on-failure
|
||||
{[testenv:mypy]commands}
|
||||
|
||||
[testenv:mypy]
|
||||
description =
|
||||
Run type checks.
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
mypy
|
||||
types-requests
|
||||
commands =
|
||||
mypy --cache-dir="{envdir}/mypy_cache" {posargs:osc_lib}
|
||||
|
||||
[testenv:venv]
|
||||
commands =
|
||||
|
||||
Reference in New Issue
Block a user