python icon indicating copy to clipboard operation
python copied to clipboard

[WIP] Switches to using python-experimental generator for client generation

Open spacether opened this issue 1 year ago • 4 comments

What type of PR is this?

What this PR does / why we need it:

This PR switches to using python-experimental generator and openapi-generator v6.1.0 Please do not review this PR into I move it out of WIP/Draft State This PR updates the python client from the python generator to the python-experimental generator which has:

  • type hints everywhere
  • more robust composition(oneOf/anyOf/allOf/not) support
  • payload someProp case used rather than python some_prop used to ensure compliance when imposing json schema keywords like properties/additionalProperties/composition. This allows a payload to contain the separate keys someProp and some_prop
  • supports newer openapi features like handling of multiple request body content types and response body content types

I am seeking feedback from your project on how you feel about using the code generated from the python-experimental generator.

Which issue(s) this PR fixes:

Fixes #

  • https://github.com/kubernetes-client/python/issues/1846
  • https://github.com/kubernetes-client/python/issues/1421
  • https://github.com/kubernetes-client/python/issues/1032

Special notes for your reviewer:

I am seeking feedback from your project on how you feel about using the code generated from the python-experimental generator.

Does this PR introduce a user-facing change?

This will require changes to how users integrate with the client.
A migration guide is included which shows what needs to be updated here
https://github.com/spacether/kube_python/tree/feat_switches_to_python_exp_client/kubernetes#migration-from-other-generators-like-python-and-python-legacy
Min allowed python version is 3.9
- Reviewer note: if you need a lower version I think that I could switch down to the 3.8 feature set because I need typing.overload and TypedDict

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


spacether avatar Sep 12 '22 18:09 spacether

@spacether: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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 12 '22 18:09 k8s-ci-robot

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: spacether / name: Justin Black (de09cfa02bb53ec96590af268fe4459a925ca33a, 975f7286715fe6319e628c588a8a016b2046c328)

Welcome @spacether!

It looks like this is your first PR to kubernetes-client/python 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-client/python has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Sep 12 '22 18:09 k8s-ci-robot

i think we should not be using the experimental generator. please file a PR to use the official generator release.

yliaog avatar Sep 26 '22 16:09 yliaog

@yliaog I just updated this PR to use the official 6.2.0 python generator

spacether avatar Sep 26 '22 19:09 spacether

@yliaog can you or others review this PR? Do I need to do anything else?

spacether avatar Oct 11 '22 15:10 spacether

could you please squash the commits? I'll take a look afterwards. Thanks.

yliaog avatar Oct 11 '22 16:10 yliaog

@yliaog just squashed them into one commit now

spacether avatar Oct 11 '22 16:10 spacether

https://github.com/spacether/kube_python/tree/feat_switches_to_python_exp_client/kubernetes#migration-from-other-generators-like-python-and-python-legacy

so this PR introduces breaking change? for breaking change, we need to solicit community feedback.

also it's better to split the PR into at least two commits, one commit for generated files, the other commit is for the manual edited files.

yliaog avatar Oct 11 '22 16:10 yliaog

https://github.com/spacether/kube_python/tree/feat_switches_to_python_exp_client/kubernetes#migration-from-other-generators-like-python-and-python-legacy

so this PR introduces breaking change? for breaking change, we need to solicit community feedback.

also it's better to split the PR into at least two commits, one commit for generated files, the other commit is for the manual edited files.

Yes the updated client has breaking changes versus the old ones. I have not manually edited files. Which files need to be manually edited/where in this code base uses the client? How do we solicit community feedback?

spacether avatar Oct 11 '22 16:10 spacether

https://github.com/kubernetes-client/gen/tree/master/openapi needs manual update?

please send email to: [email protected]

file an issue similar to: https://github.com/kubernetes-client/python/issues/974

yliaog avatar Oct 11 '22 17:10 yliaog

My plan is to wait until 6.2.1 is released to get community feedback

spacether avatar Oct 18 '22 16:10 spacether

sounds good. thanks.

yliaog avatar Oct 18 '22 16:10 yliaog

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: spacether Once this PR has been reviewed and has the lgtm label, please assign yliaog for approval by writing /assign @yliaog in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Nov 01 '22 19:11 k8s-ci-robot

Just posted an email in https://groups.google.com/a/kubernetes.io/g/dev which looks like the newest google group to use

spacether avatar Nov 02 '22 19:11 spacether

@spacether Could you update examples/ and e2e tests?

tomplus avatar Nov 02 '22 22:11 tomplus