Skip to content

Commit

Permalink
Add support for static type checking using mypy (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
hackdna authored Nov 2, 2021
1 parent 944a6d9 commit 1466d57
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install dev dependecies
run: pip install -r requirements.txt
- name: Run static type checking
run: mypy forest
- name: Run tests
run: python -m unittest tests/imports.py
Empty file added forest/poplar/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion forest/poplar/raw/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
The numeric <code> does not appear in raw Beiwe data. These are intended
to provide a convenient & consistent encoding for variable levels.
'''
POWER_EVENTS = {'Android': {}, 'iOS': {}}
POWER_EVENTS = {'Android': {}, 'iOS': {}} # type: ignore
with open(DOCPATHS['power_events.csv']) as f:
next(f) # skip header row
for line in f:
Expand Down
23 changes: 23 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[mypy]
python_version = 3.6

[mypy-forest.poplar.legacy.common_funcs.*]
ignore_missing_imports = True

[mypy-holidays]
ignore_missing_imports = True

[mypy-numpy]
ignore_missing_imports = True

[mypy-openrouteservice]
ignore_missing_imports = True

[mypy-pandas]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True

[mypy-timezonefinder]
ignore_missing_imports = True
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mypy==0.910
pytest==6.2.5
pytest-mock==3.6.1
types-dataclasses==0.6.1
types-pytz==2021.3.0
types-setuptools==57.4.2

0 comments on commit 1466d57

Please sign in to comment.