Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Resolve inconsistent typing in 37.0.0 delete operations

Ouverte
#2,752 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
55/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
python

Piste de recherche

The issue names delete methods in kubernetes/client/api/core_v1_api.py; start by comparing their return type hints with the corresponding generated API definitions and create, patch, and replace methods. Check whether delete responses should consistently use the resource model or the status model, then inspect the related generated tests. Done means the delete methods have consistent, accurate type hints and the tests cover the expected response types.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

kind/feature

What is the feature and why do you need it:
The Pydantic migration in 37.0.0 added strong typing, mostly, to the forward facing APIs. Which I greatly appreciate.

Where delete calls used to return V1Status they now generally return the appropriate model for their api type which matches the other APIs including golang.

Unfortunately, the typing is inconsistent on delete calls making it difficult to deal with.

Examples from:
https://raw.githubusercontent.com/kubernetes-client/python/refs/heads/master/kubernetes/client/api/core_v1_api.py

def delete_namespaced_config_map(...) -> object:
def delete_namespaced_endpoints(...) -> object:
def delete_namespaced_persistent_volume_claim(...) -> V1PersistentVolumeClaim:
def delete_namespaced_pod(...) -> V1Pod:
def delete_namespaced_pod_template(...) -> V1PodTemplate:
def delete_namespaced_resource_quota(...) -> V1ResourceQuota:

Describe the solution you'd like to see:
Resolve the inconsistent typehinting on delete calls. For whatever reason create, patch, replace don't have this problem.

Sample code:

>>> import kubernetes
>>> kubernetes.config.load_config()
>>> corev1 = kubernetes.client.api.CoreV1Api()
>>> metadata = kubernetes.client.V1ObjectMeta(name="test", namespace="default")
>>> configmap = kubernetes.client.V1ConfigMap(metadata=metadata)
>>> new_map = corev1.create_namespaced_config_map(namespace="default", body=configmap)
>>> type(new_map)
<class 'kubernetes.client.models.v1_config_map.V1ConfigMap'>
>>> delete_map = corev1.delete_namespaced_config_map(name="test", namespace="default")
>>> type(delete_map)
<class 'dict'>
>>> print(delete_map)
{'kind': 'Status', 'apiVersion': 'v1', 'metadata': {}, 'status': 'Success', 'details': {'name': 'test', 'kind': 'configmaps', 'uid': 'b4e19f90-ed1e-4e44-bed1-0bfbc64e1982'}}
>>> deleted_pot = corev1.delete_namespaced_pod(name="example", namespace="default")
>>> deleted_pod = corev1.delete_namespaced_pod(name="example", namespace="default")
>>> type(deleted_pod)
<class 'kubernetes.client.models.v1_pod.V1Pod'>
Langage dominant
Python
Étoiles
7.7k
Forks
3.5k
Merge moyen
1 j 13 h
PR mergées (30 j)
21

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de kubernetes-client/python

Toutes les issues de kubernetes-client/python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.