flatironinstitute / bayes-kit

Bayesian inference and posterior analysis for Python
MIT License
41 stars 3 forks source link

Add mypy and black to CI #26

Closed WardBrian closed 1 year ago

WardBrian commented 1 year ago

As discussed in #16, this will run mypy and black against PRs. At the moment it will fail because main doesn't pass these checks, but after main does I will rebase and merge this

codecov-commenter commented 1 year ago

Codecov Report

Merging #26 (90bcde3) into main (3157c8f) will decrease coverage by 0.09%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
- Coverage   98.10%   98.01%   -0.09%     
==========================================
  Files          11       11              
  Lines         316      302      -14     
==========================================
- Hits          310      296      -14     
  Misses          6        6              
Impacted Files Coverage Δ
bayes_kit/__init__.py 100.00% <100.00%> (ø)
bayes_kit/autocorr.py 100.00% <100.00%> (ø)
bayes_kit/ensemble.py 100.00% <100.00%> (ø)
bayes_kit/ess.py 100.00% <100.00%> (ø)
bayes_kit/hmc.py 94.59% <100.00%> (-0.28%) :arrow_down:
bayes_kit/iat.py 100.00% <100.00%> (ø)
bayes_kit/mala.py 93.54% <100.00%> (-0.40%) :arrow_down:
bayes_kit/metropolis.py 100.00% <100.00%> (ø)
bayes_kit/rhat.py 100.00% <100.00%> (ø)
bayes_kit/smc.py 95.83% <100.00%> (-0.09%) :arrow_down:
... and 1 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

WardBrian commented 1 year ago

l 48 warns that the call to scipy.stats.beta.logpdf returns an NDArray not a float

Pylance is lying to you

>>> isinstance(scipy.stats.beta.logpdf(.1, 3, 2), float)
True

(it does return an array if the first argument is an array, but it isn't in this model)

I think I resolved the other pylance warnings, though I'm not sure if they were also spurious