Skip to content

Adding typing hints#773

Closed
ThosRTanner wants to merge 1 commit into
python-zk:masterfrom
ThosRTanner:add-typing-hints
Closed

Adding typing hints#773
ThosRTanner wants to merge 1 commit into
python-zk:masterfrom
ThosRTanner:add-typing-hints

Conversation

@ThosRTanner
Copy link
Copy Markdown
Contributor

Fixes #

Why is this needed?

Proposed Changes

  • change 1
  • change 2
  • ...

Does this PR introduce any breaking change?

Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py
Comment thread kazoo/client.py
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py
Comment thread kazoo/client.py
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/recipe/lock.py Outdated
Comment thread kazoo/recipe/lock.py Outdated
Comment thread kazoo/recipe/lock.py
Comment thread kazoo/recipe/watchers.py Outdated
Comment thread kazoo/recipe/watchers.py Outdated
Comment thread kazoo/handlers/utils.py
Comment thread kazoo/handlers/utils.py Outdated
Comment thread kazoo/protocol/connection.py Outdated
Comment thread kazoo/protocol/connection.py
Comment thread kazoo/protocol/connection.py
Comment thread kazoo/client.py
Comment thread kazoo/client.py
@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 3 times, most recently from 339f1ec to 7edcb3b Compare April 22, 2026 17:08
Comment thread kazoo/recipe/partitioner.py Outdated
Comment thread kazoo/recipe/watchers.py
Comment thread kazoo/recipe/watchers.py Outdated
@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 2 times, most recently from 5da635b to d67849a Compare April 23, 2026 05:56
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 99.01424% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.58%. Comparing base (86e69f2) to head (ebb5665).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
kazoo/handlers/eventlet.py 92.10% 3 Missing ⚠️
kazoo/protocol/connection.py 95.77% 3 Missing ⚠️
kazoo/handlers/utils.py 97.87% 1 Missing ⚠️
kazoo/protocol/serialization.py 99.26% 1 Missing ⚠️
kazoo/recipe/lock.py 97.91% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #773      +/-   ##
==========================================
- Coverage   96.67%   95.58%   -1.10%     
==========================================
  Files          27       27              
  Lines        3553     3895     +342     
==========================================
+ Hits         3435     3723     +288     
- Misses        118      172      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 4 times, most recently from a9318af to 5168260 Compare April 23, 2026 13:41
Comment thread kazoo/handlers/utils.py Outdated
@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 5 times, most recently from 7063c61 to f62a077 Compare April 28, 2026 20:03
Comment thread kazoo/client.py Outdated
Comment thread kazoo/client.py Outdated
Comment thread kazoo/interfaces.py Outdated
@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 3 times, most recently from 5035143 to ec7dc06 Compare April 28, 2026 21:15
@StephenSorriaux
Copy link
Copy Markdown
Member

Really appreciate the tons of work you put into this PR. Can't wait to see it ready!

@ThosRTanner
Copy link
Copy Markdown
Contributor Author

Really appreciate the tons of work you put into this PR. Can't wait to see it ready!
I shall probably put in a brand new PR - this one is a bit of a mess considering my problems with hound...

@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 2 times, most recently from b724031 to f027cf3 Compare May 3, 2026 08:06
@ThosRTanner ThosRTanner closed this May 3, 2026
@ThosRTanner ThosRTanner reopened this May 3, 2026
@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 2 times, most recently from 09c3b2e to b40a0da Compare May 3, 2026 21:20
@ThosRTanner ThosRTanner closed this May 7, 2026
@ThosRTanner ThosRTanner reopened this May 7, 2026
@ThosRTanner ThosRTanner closed this May 8, 2026
@ThosRTanner ThosRTanner reopened this May 8, 2026
Comment thread kazoo/tests/test_cache.py Outdated
@ThosRTanner ThosRTanner force-pushed the add-typing-hints branch 6 times, most recently from 1d2790c to 91934ff Compare May 10, 2026 16:16
Comment thread kazoo/tests/test_election.py
Comment thread kazoo/tests/test_election.py Outdated
Comment thread kazoo/tests/test_sasl.py Outdated
Comment thread kazoo/tests/test_sasl.py Outdated
This adds nearly full type hinting, and enables all but two of the mypy
checks that were enabled in the mypy section in pyproject.toml. I hope
to address the remaining checks, but it was proving tricky to address
some of the 'typing.Any' uses.

Also if you enable deprecation checks with

--enable-error-code=deprecated

You'll get warnings if you use deprecated options (at least as far as I
was able to spot them!)

This addresses python-zk#647 but there's not entirely strict checking as yet.

Although I've tried very hard not to change any code for this, some
`return None` statements have been added, which has caused the code
coverage to drop as apparently those return paths were not covered
by the testing.

Also I've been less polite with the testing, and have changed the code
in a number of places, including dropping test classes that did nothing,
and adding asserts here and there to keep mypy happy as it sometimes
doesn't spot a value could have been changed.

I've added FIXMEs to address some of the more egregious type warning
suppression that I did to avoid doing code changes, and intend to
address those in another PR.

A note: I've also had to suppress some errors in flake8 and use more
general 'type: ignore' suppressions than I'd like because hound CI
does something very very odd and tries to parse the text in the []
of the type: ignore[] comments as python, and generates some very
peculiar messages.
@ThosRTanner
Copy link
Copy Markdown
Contributor Author

closed in favour of 791 because this is now unreadable

@ThosRTanner
Copy link
Copy Markdown
Contributor Author

Really appreciate the tons of work you put into this PR. Can't wait to see it ready!
@StephenSorriaux I've closed this PR and opened a new one mainly because of the stream of hound errors which makes this almost unreadable - see #791

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants