Skip to content

Commit 02d0c26

Browse files
committed
Add mypy static checker tool
Added to tox as `mypy` target Signed-off-by: Martin Hickey <[email protected]>
1 parent 16fc615 commit 02d0c26

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,24 @@ from-first=true
122122
# import_heading_localfolder="Local"
123123
known-local-folder=["fms_mo","tests"]
124124
# extend-skip="fms_mo/_version.py"
125+
126+
[tool.mypy]
127+
mypy_path = [""]
128+
packages = ["fms_mo", "tests"]
129+
disable_error_code = []
130+
# TODO: tighten MyPy checks by enabling these checks over time.
131+
check_untyped_defs = false
132+
disallow_incomplete_defs = false
133+
disallow_untyped_defs = false
134+
warn_return_any = true
135+
# honor excludes by not following there through imports
136+
follow_imports = "silent"
137+
exclude = []
138+
139+
[[tool.mypy.overrides]]
140+
# packages without typing annotations, without stubs, or not available.
141+
module = [
142+
"datasets",
143+
"huggingface_hub.*",
144+
]
145+
ignore_missing_imports = true

tox.ini

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ commands =
7474
{envpython} -m pyspelling --config {toxinidir}/.spellcheck.yml --spellchecker aspell
7575
allowlist_externals = sh
7676

77+
[testenv:mypy]
78+
description = Python type checking with mypy
79+
basepython = {[testenv:py3]basepython}
80+
deps =
81+
mypy>=1.10.0,<1.14
82+
types-PyYAML
83+
types-requests
84+
types-tqdm
85+
types-psutil
86+
pytest
87+
pydantic<=2.9.2
88+
commands =
89+
mypy {posargs}
90+
7791
[gh]
7892
python =
7993
3.11 = 3.11-{unitcov}

0 commit comments

Comments
 (0)