Drain3 icon indicating copy to clipboard operation
Drain3 copied to clipboard

Add full typing support to the library.

Open no-preserve-root opened this issue 2 years ago • 1 comments

At the moment, Drain3 has incomplete and/or missing types on some classes and functions. This PR adds full typing everywhere (so mypy --strict passes) and adds the missing py.typed marker file. There are some changes to the codebase (reassignments that change type, missing abstract methods) that should not change semantics, plus one bugfix.

Changes in details:

  • MyPy and available type stubs added to dev dependencies.
  • Type annotations are used everywhere. Abstract types (Mapping etc.) are preferred. The library passes mypy --strict tests.
  • Minor logic changes and new asserts to support typing.
  • Introduction of abstract methods in DrainBase.
  • 'parameter_extraction_cache_capacity' is now correctly parsed as an int.
  • py.typed marker added (fixes #84).

no-preserve-root avatar Aug 27 '23 17:08 no-preserve-root

@no-preserve-root Thank you for the contribution! This is very important. I will review it this weekend.

Superskyyy avatar Sep 07 '23 01:09 Superskyyy

@Superskyyy can this PR be resurrected.

wiperpaul avatar Apr 24 '24 11:04 wiperpaul

@Superskyyy can this PR be resurrected.

Yes, I have reviewed the changes, LGTM. A new version will be released to pypi once I verify things are working fine. Very sorry for the delay. @no-preserve-root @wiperpaul thanks for the contribution!

Superskyyy avatar Apr 24 '24 12:04 Superskyyy