Skip to content

Commit a647f36

Browse files
authored
Merge pull request #1655 from the-mr-dave/testing/mypy-initial-setup
Add initial mypy configuration and CI integration
2 parents 23deea8 + 2bd8cab commit a647f36

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/basic.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ jobs:
6262
pip install -e .
6363
flake8 libensemble
6464
65+
- name: Install mypy
66+
run: pip install mypy
67+
68+
- name: Run mypy (limited scope)
69+
run: mypy
70+
6571
- name: Remove various tests on newer pythons
6672
if: matrix.python-version == 'py311' || matrix.python-version == 'py312' || matrix.python-version == 'py313' || matrix.python-version == 'py314'
6773
run: |

libensemble/utils/misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def extract_H_ranges(Work: dict) -> str:
1818
else:
1919
# From https://stackoverflow.com/a/30336492
2020
ranges = []
21-
for diff, group in groupby(enumerate(work_H_rows.tolist()), lambda x: x[0] - x[1]):
22-
group = list(map(itemgetter(1), group))
21+
for diff, group_iter in groupby(enumerate(work_H_rows.tolist()), lambda x: x[0] - x[1]):
22+
group = list(map(itemgetter(1), group_iter))
2323
if len(group) > 1:
2424
ranges.append(str(group[0]) + "-" + str(group[-1]))
2525
else:

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,15 @@ inpt = "inpt"
258258
extend-exclude = ["*.bib", "*.xml", "docs/nitpicky"]
259259

260260
[tool.mypy]
261+
# Initial, permissive mypy configuration for libensemble.
262+
# Allows incremental adoption. To be tightened in future releases.
263+
packages = ["libensemble.utils"]
264+
exclude = '''
265+
libensemble/utils/(launcher|loc_stack|runners|pydantic|output_directory)\.py
266+
'''
261267
disable_error_code = ["import-not-found", "import-untyped"]
268+
ignore_missing_imports = true
269+
follow_imports = "skip"
270+
check_untyped_defs = false
271+
disallow_untyped_defs = false
272+
warn_unused_ignores = false

0 commit comments

Comments
 (0)