question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Advertise type hints with py.typed

See original GitHub issue

From #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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:23 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
felix-hildencommented, Jan 14, 2021

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.

1reaction
HarrySkycommented, Jan 12, 2021

@felix-hilden will try it tomorrow evening😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type Hints in Python — Everything You Need To Know In 5 ...
Implement type hints and static type checks in Python scripts. Source code included. ... Python has always been a dynamically typed language, ...
Read more >
PEP 484 – Type Hints - Python Enhancement Proposals
Acceptable type hints. Type hints may be built-in classes (including those defined in standard library or third-party extension modules), abstract base classes, ...
Read more >
Python typing module - Use type checkers effectively
Introduced since Python 3.5, Python's typing module attempts to provide a way of hinting types to help static type checkers and linters ...
Read more >
Get started with Python type hints | InfoWorld
Learn how to use Python's optional type hinting syntax for creating cleaner and more useful code bases.
Read more >
Python Typing - Type Hints & Annotations - YouTube
Welcome back to another video! In this video, I'll be covering content from the typing module in Python like type hints and annotations....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found