python icon indicating copy to clipboard operation
python copied to clipboard

Explore the possibility of type hinting

Open mbohlool opened this issue 7 years ago • 24 comments

Python 3 has a type hinting feature very useful for auto complete. This issue is for tracking efforts on researching its backward compatibility with python 2 (from __future__ import import annotations?) and if possible, change code generator to implement it. Best if we contribute it back to swagger-codegen.

mbohlool avatar May 20 '17 16:05 mbohlool

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Apr 21 '19 08:04 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar May 21 '19 09:05 fejta-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Jun 20 '19 10:06 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jun 20 '19 10:06 k8s-ci-robot

Ping? This is still annoying to have no auto completion in my IDE. Any chance of getting this in?

sebastian-philipp avatar Jul 19 '19 09:07 sebastian-philipp

/reopen

evanmosseri avatar Sep 09 '19 22:09 evanmosseri

@evanmosseri: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 09 '19 22:09 k8s-ci-robot

This issue is one reason I wrote my own generator: https://github.com/sebastian-philipp/rook-ceph-client-python

sebastian-philipp avatar Sep 18 '19 13:09 sebastian-philipp

/reopen

micw523 avatar Sep 18 '19 15:09 micw523

@micw523: Reopened this issue.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 18 '19 15:09 k8s-ci-robot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Oct 18 '19 16:10 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Oct 18 '19 16:10 k8s-ci-robot

/reopen /lifecycle frozen

micw523 avatar Oct 18 '19 16:10 micw523

@micw523: Reopened this issue.

In response to this:

/reopen /lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Oct 18 '19 16:10 k8s-ci-robot

Type hinting would be more useful for using the APIs in this client (compared to config-loading, watch, etc), which are mostly generated by openapi-generator. I wonder if openapi-generator support type hinting.

cc @tomplus @scottilee

roycaihw avatar Dec 10 '19 19:12 roycaihw

In the meantime, I've made https://github.com/ceph/rook-client-python to generate client API classes for CRDs . It contains a code generator that is usable independently of this project.

If there is an interest, the code generator could certainly be moved into a dedicated project.

sebastian-philipp avatar Feb 13 '20 08:02 sebastian-philipp

Tracking here: https://github.com/OpenAPITools/openapi-json-schema-generator/issues/30

scottilee avatar Feb 08 '21 00:02 scottilee

I hacked together an external type stubs package for now: https://pypi.org/project/kubernetes-stubs/. Perhaps it's of use to some other folks!

benesch avatar Jul 17 '21 08:07 benesch

For those who want to typecheck existing custom resources without generating additional code - I've created mypy plugin that can do this based on openapi spec from CRD yamls https://pypi.org/project/kubernetes-typed/.

gordonbondon avatar Sep 05 '21 18:09 gordonbondon

This is such a needed feature :smiling_face_with_tear:

shinebayar-g avatar Jul 29 '22 04:07 shinebayar-g

/help

roycaihw avatar Aug 16 '22 16:08 roycaihw

@roycaihw: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Aug 16 '22 16:08 k8s-ci-robot

I hacked together an external type stubs package for now: https://pypi.org/project/kubernetes-stubs/. Perhaps it's of use to some other folks!

kubernetes-stubs has not provided stubs for kubernetes >= 23.0 yet (2023-06-03).

I forked it to kubernetes-stubs-elephant-fork which provides stubs for all releases after 7.0 of kubernetes, even includes any release in the future automatically.

I run a crontab by github actions which looks for new releases of kubernetes and build typing stubs for it.

lexdene avatar Jun 04 '23 09:06 lexdene