Skip to content

mypy integration #12

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

Closed
iddan opened this issue Jun 6, 2019 · 4 comments · Fixed by #13
Closed

mypy integration #12

iddan opened this issue Jun 6, 2019 · 4 comments · Fixed by #13

Comments

@iddan
Copy link

iddan commented Jun 6, 2019

Collections should implement mypy Mapping generic to be properly typed

@iddan iddan changed the title Mypy integration mypy integration Jun 6, 2019
@antonagestam
Copy link
Contributor

I'd be happy to get the ball rolling if PR's will be considered for this :)

antonagestam added a commit to antonagestam/immutables that referenced this issue Jul 6, 2019
@iddan
Copy link
Author

iddan commented Jul 7, 2019

You just made my day 😄

@antonagestam
Copy link
Contributor

It turned out that this what a bit more complicated than I originally thought. For types such as Map[str, int] to not break at runtime the Map class needs to be subscribable. You normally achieve that by making it inherit from typing.Mapping (or typing.Generic). But since Map is implemented as a C extension this doesn't seem that straight forward. It might be simple to do this in the C implementation though, I'll try and dig further when I get the time.

@antonagestam
Copy link
Contributor

Got some tips in the typing gitter channel: https://gitter.im/python/typing?at=5d25bd59cdb70805c96e239f

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 a pull request may close this issue.

2 participants