xgcm / xhistogram

Fast, flexible, label-aware histograms for numpy and xarray
https://xhistogram.readthedocs.io
MIT License
90 stars 20 forks source link

Type checking with mypy #38

Closed dougiesquire closed 3 years ago

dougiesquire commented 3 years ago

I've set up type checking with mypy, and I have it running successfully locally with a few minor changes (that is, mypy xhistogram passes succesfully).

I've added mypy into pre-commit, but we're failing here. The issue is that when run with pre-commit, mypy seems to want to check versioneer.py, which sits in the base directory. I'm not sure why and I can't work out how to exclude it. What I've tried:

I'm sure I'm doing something daft, but I'd appreciate some help. Once I can get mypy into our CI, then I can dive in and try and add static typing to xhistogram methods.

codecov[bot] commented 3 years ago

Codecov Report

Merging #38 (5351223) into master (40b6f3a) will not change coverage. The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #38   +/-   ##
=======================================
  Coverage   94.41%   94.41%           
=======================================
  Files           3        3           
  Lines         215      215           
  Branches       58       58           
=======================================
  Hits          203      203           
  Misses          8        8           
  Partials        4        4           
Impacted Files Coverage Δ
xhistogram/duck_array_ops.py 78.26% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 40b6f3a...5351223. Read the comment docs.

dougiesquire commented 3 years ago

@jrbourbeau, @rabernat perhaps you have some insight here?

dougiesquire commented 3 years ago

Following these recommendations, I've also just tried setting

[mypy]
exclude = '/versioneer\.py$'

within setup.cfg without success.

dougiesquire commented 3 years ago

For the pre-commit hook, you might try specifying explicitly specifying the files to check instead of which ones to exclude

Thanks @jrbourbeau, works great! Though we're now failing some of our tests and I'm not yet sure why. The tests are passing locally...