Open nannau opened 4 years ago
Yeah, the output is not clear as to what is a test failure and what are warnings. It says that mypy
is the failure:
=========================================== short test summary info ===========================================
FAILED ::mypy
But then all of the actionable mypy
output is in the warning section (and warnings shouldn't affect the test outcome).
Do you get clearer output if you run mypy
directly. Or do we tune to tune the configuration to omit warnings that we're not concerned about (e.g. upstream packages)?
Good idea, it does tell us to use mypy
from master
on GH... (?)
climpyrical/mask.py:7: error: Skipping analyzing 'nptyping': found module but no type hints or library stubs
climpyrical/mask.py:7: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
climpyrical/mask.py:9: error: Skipping analyzing 'shapely.geometry': found module but no type hints or library stubs
climpyrical/mask.py:10: error: Skipping analyzing 'tqdm': found module but no type hints or library stubs
climpyrical/mask.py:11: error: Skipping analyzing 'geopandas': found module but no type hints or library stubs
climpyrical/gridding.py:6: error: Skipping analyzing 'scipy.interpolate': found module but no type hints or library stubs
climpyrical/gridding.py:7: error: Skipping analyzing 'pyproj': found module but no type hints or library stubs
climpyrical/gridding.py:8: error: Skipping analyzing 'nptyping': found module but no type hints or library stubs
climpyrical/data.py:3: error: Skipping analyzing 'nptyping': found module but no type hints or library stubs
climpyrical/data.py:6: error: Skipping analyzing 'scipy.interpolate': found module but no type hints or library stubs
/home/nannau/tri/lib/python3.6/site-packages/xarray/core/dataarray.py:1906: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 0.782
/home/nannau/tri/lib/python3.6/site-packages/xarray/core/dataarray.py:1906: : note: please use --show-traceback to print a traceback when reporting a bug
To no avail... The same error appears. It seems to be caused by xarray's dataarray.py
for mypy==0.790+dev.49a8c102a11d3ec8ffc48dc0a6d5409ed60767fd
(master).
$ mypy climpyrical/mask.py
climpyrical/mask.py:7: error: Skipping analyzing 'nptyping': found module but no type hints or library stubs
climpyrical/mask.py:7: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
climpyrical/mask.py:9: error: Skipping analyzing 'shapely.geometry': found module but no type hints or library stubs
climpyrical/mask.py:10: error: Skipping analyzing 'tqdm': found module but no type hints or library stubs
climpyrical/mask.py:11: error: Skipping analyzing 'geopandas': found module but no type hints or library stubs
climpyrical/gridding.py:6: error: Skipping analyzing 'scipy.interpolate': found module but no type hints or library stubs
climpyrical/gridding.py:7: error: Skipping analyzing 'pyproj': found module but no type hints or library stubs
climpyrical/gridding.py:8: error: Skipping analyzing 'nptyping': found module but no type hints or library stubs
climpyrical/data.py:3: error: Skipping analyzing 'nptyping': found module but no type hints or library stubs
climpyrical/data.py:6: error: Skipping analyzing 'scipy.interpolate': found module but no type hints or library stubs
/home/nannau/tri/lib/python3.6/site-packages/xarray/core/dataarray.py:2879: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 0.790+dev.49a8c102a11d3ec8ffc48dc0a6d5409ed60767fd
/home/nannau/tri/lib/python3.6/site-packages/xarray/core/dataarray.py:2879: : note: please use --show-traceback to print a traceback when reporting a bug
To be clear, I'm referring to this error, not the stub related errors:
/xarray/core/dataarray.py:1906: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
If this issue cont
Type hints are now included in every function in
climpyrical
, but enforcing them withmypy
is less straightforward.mypy
requires certain third-party criteria to be met. Sinceclimpyrical
often uses non-standard object types (numpy, xarray, geopandas, shapely, etc...), some effort will need to be made to getmypy
to recognize and enforce these type hints. See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-type-hints-for-third-party-library for more information.To reproduce problems, run
pytest
with themypy
extension:pytest --mypy climpyrical/tests
Gives confusing results:
Note with
mypy.ini
config file set as: