Skip to content

Commit

Permalink
tox: Add & configure mypy static type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitronx committed Aug 11, 2023
1 parent ccd6008 commit c64b910
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ legacy_tox_ini = """
[tox]
requires =
tox>=4
#env_list = linters, type, py{38,39,310,311}
env_list = linters, py{38,39,310,311}
env_list = linters, type, py{38,39,310,311}
[gh-actions]
python =
Expand Down Expand Up @@ -102,6 +101,14 @@ commands =
{[testenv:flake8]commands}
{[testenv:bandit]commands}
[testenv:type]
description = run type checking
basepython = python3.11
skip_install = true
deps =
{[testenv:mypy]deps}
commands =
{[testenv:mypy]commands}
[testenv:black]
description = run black code formatter
Expand Down Expand Up @@ -133,6 +140,17 @@ deps =
commands =
bandit -c "pyproject.toml" -v -r {toxinidir}/src
[testenv:mypy]
description = run mypy static type checker
skip_install = true
basepython = python3.11
deps =
mypy
commands =
mypy {posargs} {toxinidir}/src
"""

[tool.black]
Expand Down Expand Up @@ -171,6 +189,14 @@ exclude_dirs = [
"tests",
]

[tool.mypy]
ignore_missing_imports = true
follow_imports = "normal"
# ignore_missing_imports = true
show_column_numbers = true
# enable_error_code = "explicit-override"
pretty = true

[tool.pytest.ini_options]
addopts = ["--import-mode=importlib"]
pythonpath = [".", "src"]
Expand Down

0 comments on commit c64b910

Please sign in to comment.