-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support for type hints #105
Comments
asyncio support is still very rudimentary. I can handle merging if you want to push out a separate PR for type hints |
Feel free to steal the type hints directly from #93 for your PR. I only have return types in that PR though, so you'll need to do the args/kwargs. |
Branch 105-support_for_type_hints created! |
I can pick this up as ive got some time spare. I will use use union instead of pipe to keep it compatible with 3.9 unless you see any issues with doing that? |
Using Unions instead of pipes is fine with me. May as well keep 3.9 support, I don't think that many people have switched over to 3.10 yet. |
Yea that was my thinking, can always swap it at a later date when 3.9 is not as common |
Ok so I have added all the types however there is an issue that mypy doesnt like when you use a Union of types with a method that then specifies a specific return. e.g. the request_handler returns multiple different types There are two possible solutions:
@Archmonger interested to see what you think would be the best approach as I've not worked with this issue before. I think both have pros and cons but unsure of what is best. |
I didn't figure out a good solution for this as well. I ended up just specifying |
Using |
Yea I'm thinking assert is going to be best, means updating all the methods but will provide the closest accuracy I think. I'll give it a try and see how it goes. |
Should probably specify |
The lack of type hinting is a pain for my development workflow, as tools like mypy outright refuse to analyze pyarr code, and even Pylance in VS Code doesn't seem to infer the types properly most of the time.
It should be fairly simple to add types, as most of the API returns
dict[str, Any]
orlist[dict[str, Any]]
. It's an implementation decision on whether or not it should be done using stubs or actually implementing it in the codebase.I can begin working on this if I can find some time, but depending on how far we've gotten on switching to using asyncio, it might be worth waiting until after that's done just so merging won't be a pain.
The text was updated successfully, but these errors were encountered: