-
Notifications
You must be signed in to change notification settings - Fork 38
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
Type definitions #138
Comments
Pook does not export types, but I'd welcome PRs to that end ❤️ |
@silverwind in case you are interested, I've added the baseline stuff for type annotations/checking pook itself in #143. My plan to get pook exporting types is to have the library itself pass type checks, as I'm not interested in maintaining separate stub files if it can possibly be avoided. To get there, I'd like to focus on small PRs that add annotations and checking to a contained section of the code each time (through judicious use of |
I don't think I can be of much help as I'm just starting to get into typed python. I do have quite a bit of typescript experience though, and in many senses, these type systems look similar, though python's system seems less fledged out, with things like the |
There are some similarities, mostly in that they are both additions over top an otherwise highly dynamic language. TS is structurally typed though, and Python is nominally typed, with structural typing only possible when explicitly using The biggest thing I've found missing in Python's type system coming from a broader TypeScript background are conditional and mapped types, and that mypy will not auto-cast strings to Literal sometimes. For what it's worth, the The main difficulty with pook will be working around somewhat tedious optional attributes/properties, where things can technically be None, but in practice never will be outside of specific, almost never relevant windows. Also some places where the types seem to indicate the code might be totally wrong (and where I'm not confident the code is actually right anyway!). It will be interesting to see if adding types to pook can be accomplished without introducing too many runtime changes. |
Could/Does this module provide type definitions?. It looks like type checkers like pyright can not find any types:
The text was updated successfully, but these errors were encountered: