aio-libs / aiokafka

asyncio client for kafka
http://aiokafka.readthedocs.io/
Apache License 2.0
1.08k stars 224 forks source link

add typing to aiokafka/protocol/* #999

Closed dimastbk closed 2 months ago

dimastbk commented 2 months ago

Changes

partial fixes #980

Add typing to all modules in protocol package.

Checklist

dimastbk commented 2 months ago

Maybe rewrite all schemas using dataclasses? If it is not a problem for performance.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 89.71963% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 95.38%. Comparing base (1855cde) to head (afe0439). Report is 5 commits behind head on master.

Files Patch % Lines
aiokafka/protocol/message.py 73.33% 9 Missing and 3 partials :warning:
aiokafka/protocol/types.py 93.40% 3 Missing and 3 partials :warning:
aiokafka/protocol/abstract.py 71.42% 0 Missing and 2 partials :warning:
aiokafka/protocol/struct.py 84.61% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #999 +/- ## ========================================== - Coverage 95.44% 95.38% -0.07% ========================================== Files 112 112 Lines 16702 16738 +36 Branches 2672 2691 +19 ========================================== + Hits 15942 15966 +24 - Misses 479 485 +6 - Partials 281 287 +6 ``` | [Flag](https://app.codecov.io/gh/aio-libs/aiokafka/pull/999/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aio-libs) | Coverage Δ | | |---|---|---| | [cext](https://app.codecov.io/gh/aio-libs/aiokafka/pull/999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aio-libs) | `92.11% <89.71%> (-0.06%)` | :arrow_down: | | [integration](https://app.codecov.io/gh/aio-libs/aiokafka/pull/999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aio-libs) | `95.03% <89.71%> (-0.07%)` | :arrow_down: | | [purepy](https://app.codecov.io/gh/aio-libs/aiokafka/pull/999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aio-libs) | `94.84% <89.71%> (-0.08%)` | :arrow_down: | | [unit](https://app.codecov.io/gh/aio-libs/aiokafka/pull/999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aio-libs) | `52.69% <87.85%> (+0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aio-libs#carryforward-flags-in-the-pull-request-comment) to find out more.

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

dimastbk commented 2 months ago

Thanks for the review, sorry for 64 comments

ods commented 2 months ago

Hmm, we forgot about test_protocol.py and test_protocol_object_conversion.py. They are important, because they allow us to verify how types in protocol module actually work. Unfortunately, they don't. We need to do something with attributes from schema, otherwise everything will in # type: ignore.