-
Notifications
You must be signed in to change notification settings - Fork 45
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
Better typing support #381
Comments
Thanks for the kind words, and for taking the time to write this up. I would be very happy see typing support improved here. Unfortunately I don't think I can personally justify the time to do a major refactor of the internals to satisfy a small group of users. But I'd be happy to chip away at it, and even happier to review and merge PRs that move things in this direction. If this issue gets a large number of 👍 reactions that may help motivate things though. I had a quick look through I think some helpful next steps would be to dig deeper into what behaviour you would expect, what's going wrong with it and most importantly why the type checker is behaving that way. Then we need a robust way of checking that things behave the way we expect from a user perspective, this may be simply running Your Lines 185 to 188 in a7a5c3c
The Also I'm curious about your experience of importing from |
In #384 I fixed up some of the async wrapping code to make it generic, so the types get passed along correctly. This solves the specific problem being raised in this issue. My next question is: what's next? What else can we do to improve typing support here? |
The initial problem of not passing types through the async wrapping machinery has been resolved. All Now that #421 is merged and we are ensuring good type hygiene I think we can close out this issue. The next step may be to turn on strict mode in |
Apologies for the delayed response - this looks good, resolves the main problem which was sync API objects having no typing support. Thanks @jacobtomlinson! |
Which project are you requesting an enhancement for?
kr8s
What do you need?
First of all, thank you for creating
kr8s
- I completely I agree with the stated motivation and was excited when I found it.The only thing that's really missing currently in my view is the lack of typing support. From what I gather, the difficulty in trying to provide better typing support stems from the current design aiming to make a "mirrored" sync and async API available via
kr8s.api
andkr8s.asyncio.api
. I am wondering if it would be possible to keep everything the same from the user's POV but refactor the internal design to allow for full typing support, at least for API objects and methods that users interact with.The main issue right now imo is that the main sync API objects have no typing support. For instance, the following results in pod always being recognized as
Any
:When trying to use
kr8s
, I ended up usingkr8s._object
instead ofkr8s.object
in imports when writing code to at least get the type checker to recognize methods and attributes. I would then switch the imports back to the real ones (kr8s._object
) to run. This is not a good dev experience for users who have become accustomed to typing support.Would a package like asyncer potentially be helpful here? Is there anything in the current sync + async compat design that needs to be taken into consideration?
I understand this would entail a significant refactor, but it is a bit of a blocker to devs like me, as much as I love everything else about the package. I would be happy to contribute to the refactor if there is an appetite, but it may take some time as I don't have a lot of time to allocate at the moment.
The text was updated successfully, but these errors were encountered: