Skip to content
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

Add python stubs for mypy #261

Open
borissmidt opened this issue Jun 21, 2023 · 5 comments
Open

Add python stubs for mypy #261

borissmidt opened this issue Jun 21, 2023 · 5 comments

Comments

@borissmidt
Copy link

It would be nice if this project had stubs so we get extra type safety.

Maybe these stubs can be reused?
https://github.com/MaterializeInc/kubernetes-stubs

@tomplus
Copy link
Owner

tomplus commented Jun 24, 2023

Thanks for your contribution but I'm working on switching to new version of generator which support annotations, so the stubs won't be needed.

@borissmidt
Copy link
Author

Oke thst sound good, i'm looking forward to that.

I think the watch stub would still be usefull with the ParamSpec.

(There is a PR as well)

For now we posted these stubs to our private repo.

@borissmidt
Copy link
Author

#262
I aded comments to highlight the files i think are still usefull. I.e. unpack and paramter spec plus the the typing of watch with an extra Watch_T type to be able to get the return type as an event.

@artificial-aidan
Copy link

Just for reference this is what i'm using to import the stubs @borissmidt provided.

kubernetes-asyncio-stubs = {ref = "add-stubs", git = "https://github.com/borissmidt/kubernetes_asyncio.git", egg = "kubernetes_asyncio-stubs", subdirectory="kubernetes_asyncio-stubs"}

It's working ok for now. The number of types unioned with None make it incredibly hard to use properly though, lots of checking if exists. But that's more of a python typing annoyance.

@borissmidt
Copy link
Author

borissmidt commented Aug 11, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants