Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pymitter type-safe #14

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Klavionik
Copy link
Contributor

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:

  1. I tried to make pymitter as type-safe as I could, except for Tree.add_listener method, where I had to leave some type: ignore directives. I believe it is fixable, but requires some refactoring.
  2. I made mypy checks compatible with Python 3.7, so I've extended the test matrix.
  3. I added a py.typed marker file, which is required for type hinted packages.
  4. 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.

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.

1 participant