kr8s-org / kr8s

A batteries-included Python client library for Kubernetes that feels familiar for folks who already know how to use kubectl
https://kr8s.org
BSD 3-Clause "New" or "Revised" License
839 stars 45 forks source link

Start getting `mypy --strict` passing #429

Closed jacobtomlinson closed 4 months ago

jacobtomlinson commented 4 months ago

Taking first steps towards #428.

I started this PR by adding some type annotations to tests before deciding to just exclude tests, but I don't see ay harm in leaving those changes in.

I think the only thing we really care about is having good type annotations on the kr8s module itself, so I've excluded all other Python code from mypy linting.

Other typing fixes here include using __all__ to explicitly re-export things at the kr8s and kr8s.asyncio levels and adding annotations to the exceptions submodule.

After this PR there are 237 errors when running mypy --strict ..

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 93.47826% with 3 lines in your changes missing coverage. Please review.

Project coverage is 95.28%. Comparing base (87063fc) to head (827391b). Report is 119 commits behind head on main.

Files with missing lines Patch % Lines
kr8s/_objects.py 25.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #429 +/- ## ========================================== + Coverage 94.61% 95.28% +0.66% ========================================== Files 29 30 +1 Lines 3141 3666 +525 ========================================== + Hits 2972 3493 +521 - Misses 169 173 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.