Skip to content

Commit afc6588

Browse files
Move mypy typing check to pre-commit hooks (#151)
* move mypy typing check to pre-commit hooks to avoid having the _version.py file * merge typing.yml and lint.yml to a unique precommit.yml and run it on every commit * change precommit.yml triggering to both push and pull_request * add some args for mypy: --ignore-missing-imports, --no-warn-unused-ignores
1 parent f566765 commit afc6588

File tree

5 files changed

+18
-36
lines changed

5 files changed

+18
-36
lines changed

.github/workflows/lint.yml renamed to .github/workflows/precommit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Lint
1+
name: Pre-commit tests
22

3-
on: [pull_request]
3+
on: [push, pull_request]
44

55
jobs:
66
lint:
@@ -15,5 +15,5 @@ jobs:
1515
- name: Install tox
1616
run: pip install tox
1717

18-
- name: Check style
19-
run: tox -e style
18+
- name: Check precommit
19+
run: tox -e precommit

.github/workflows/typing.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,14 @@ repos:
1111
rev: 22.6.0
1212
hooks:
1313
- id: black
14+
15+
- repo: https://github.com/pre-commit/mirrors-mypy
16+
rev: v1.5.1
17+
hooks:
18+
- id: mypy
19+
exclude: |
20+
(?x)(
21+
^tests/|
22+
^docs
23+
)
24+
args: [--strict, --ignore-missing-imports, --no-warn-unused-ignores]

src/iterative_ensemble_smoother/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44
https://www.frontiersin.org/articles/10.3389/fams.2019.00047/full
55
"""
66
try:
7-
from ._version import version as __version__
7+
from ._version import version as __version__ # type: ignore
88
from ._version import version_tuple
99
except ImportError:
1010
__version__ = "unknown version"
1111
version_tuple = (0, 0, "unknown version", "unknown commit")
12-
13-
from iterative_ensemble_smoother._iterative_ensemble_smoother import (
14-
ES,
15-
SIES,
16-
)
12+
from iterative_ensemble_smoother._iterative_ensemble_smoother import ES, SIES
1713
from iterative_ensemble_smoother.esmda import ESMDA
1814

1915
__all__ = [

tox.ini

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ commands =
1313
pytest tests/
1414
pytest src/ --doctest-modules
1515

16-
[testenv:style]
16+
[testenv:precommit]
1717
deps = pre-commit
1818
skip_install = true
1919
commands = pre-commit run --all-files --show-diff-on-failure
@@ -25,12 +25,6 @@ commands =
2525
python -m ipykernel install --user
2626
sphinx-build -c docs/source/ -b html docs/source/ docs/build/html -W
2727

28-
[testenv:typing]
29-
deps =
30-
.[dev]
31-
skip_install = true
32-
commands = mypy --strict src/iterative_ensemble_smoother
33-
3428
[pytest]
3529
addopts =
3630
-ra

0 commit comments

Comments
 (0)