pymitter
pymitter copied to clipboard
Make pymitter type-safe
Hey! I'm using pymitter in a couple of projects and I'm really missing the type hints. So this is my attempt to fix this problem.
What I did:
- I tried to make pymitter as type-safe as I could, except for
Tree.add_listener
method, where I had to leave sometype: ignore
directives. I believe it is fixable, but requires some refactoring. - I made
mypy
checks compatible with Python 3.7, so I've extended the test matrix. - I added a
py.typed
marker file, which is required for type hinted packages. - I've also included a refactoring commit to get rid of the
object
inheritance (which isn't required, I believe, since Python 3).
Please note that I had to introduce a breaking change - the ttl
parameter of on
and on_any
methods had to become a keyword argument, breaking callers who pass it as a positional argument. This way I could make use of @overload
to more accurately describe signatures both for decorated and non-decorated usage.