python icon indicating copy to clipboard operation
python copied to clipboard

Properly annotate functions

Open Bladieblah opened this issue 1 year ago • 2 comments

What is the feature and why do you need it: The client is very unfriendly to use in its current state. Many function arguments are only specified in the docstrings, with the function signature simply containing **kwargs. The function bodies often use "locals()" instead of the params themselves which is very poor practice in general. most egregiously, the client makes no distinction whatsoever between required and optional attributes. This means that any codebase needs to implement this logic itself.

Describe the solution you'd like to see:

  • Use proper typehints and fully qualify function signatures where possible.
  • Do not use locals() unless it's actually necessary.
  • Validate that required attributes are present in a response and explicitly annotate optional attributes as Optional

Bladieblah avatar Aug 20 '24 08:08 Bladieblah

The majority of this client is generated based on openapi-generator (https://github.com/OpenAPITools/openapi-generator). Could you file feature request to the upstream generator?

roycaihw avatar Aug 28 '24 20:08 roycaihw

The majority of this client is generated based on openapi-generator (https://github.com/OpenAPITools/openapi-generator). Could you file feature request to the upstream generator?

How does that help when this client seems to be stuck on an ancient version of the upstream generator?

Ref: https://github.com/kubernetes-client/python/blob/master/scripts/update-client.sh#L25

haskjold avatar Sep 03 '24 08:09 haskjold

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Dec 02 '24 08:12 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jan 01 '25 08:01 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Jan 31 '25 08:01 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

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-sigs/prow repository.

k8s-ci-robot avatar Jan 31 '25 08:01 k8s-ci-robot