Advertise type hints with py.typed
See original GitHub issueFrom #109 (@HarrySky): I think this is a broader issue than only models, so let’s have it in a separate issue.
About type hints - it would be great to add py.typed file to package (PEP 561). It will show mypy that this package has type hints and it will give more helpful analysis.
- Create empty file
tekore/py.typed
- Add line to
MANIFEST.in
:include tekore/py.typed
I think this could be a nice addition. However, I think our type hinting is not at the level that mypy would be happy with it. This has been discussed in #64 already, during which I decided not to change much for mypy. But maybe we ought to have another look. But I think with a py.typed
there is a notion that the type hints are absolutely correct, which they most certainly are not at the moment. We’ve got most of it right, but for simplicity for example the client endpoints only return e.g. FullTrack
instead of Union[FullTrack, Coroutine[None, None, FullTrack]]
. I’ll look into it.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:23 (23 by maintainers)
I think we are at a crossroads here. So here’s what I’m thinking. Currently we cannot advertise the package as typed. But there should be a conversation about whether we should use a different client for async things. So I’ll merge the changes (perhaps excluding the union injections), close this issue for the time being and open another one for discussing that. Then if we reach a conclusion where the second client is implemented, we can re-evaluate stricter typing.
@felix-hilden will try it tomorrow evening😁