Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Resolve inconsistent typing in 37.0.0 delete operations

Đang mở
#2,752 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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'>
Ngôn ngữ chính
Python
Star
7.7k
Fork
3.5k
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
21

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của kubernetes-client/python

Tất cả issue của kubernetes-client/python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.