Registry / type-stubs / kubernetes-typed

kubernetes-typed

JSON →
library18.20.2pypypi✓ verified 80d ago

Collection of mypy plugins and stubs for Kubernetes to enable strong typing of Kubernetes objects. Current version: 18.20.2. Released as needed, follows kubernetes Python client versioning.

pip install kubernetes-typed
INSTALL
IMPORT
SIG · KUBERNETES-TYPED
K
kubernetes-typed
type-stubspythonv18.20.2
Install
4.3s avg
Import
Disk
93MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v18.20.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 94.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.3s · import 0.000s · 94MB
93MB installed
● package 93MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CustomResource
from crd_typed import CustomResource
from kubernetes.client.models import V1Deployment
Any
from crd_typed import Any
Dict
from crd_typed import Dict

Create a strongly-typed Kubernetes Deployment object using kubernetes-typed stubs.

from kubernetes import client from kubernetes.client.models import V1Deployment def create_deployment() -> V1Deployment: return V1Deployment( api_version="apps/v1", kind="Deployment", metadata=client.V1ObjectMeta(name="example"), spec=client.V1DeploymentSpec( replicas=1, selector=client.V1LabelSelector(match_labels={"app": "example"}), template=client.V1PodTemplateSpec( metadata=client.V1ObjectMeta(labels={"app": "example"}), spec=client.V1PodSpec( containers=[client.V1Container(name="nginx", image="nginx:1.14.2")] ) ) ) )
Debug
Known issues
gotchakubernetes-typed provides stubs for the kubernetes Python client; it does NOT replace the full kubernetes library. You must also install kubernetes.
fix
pip install kubernetes kubernetes-typed
affects: all
breakingVersion 18.20.0 introduced many changes; pin to exact minor if you encounter issues. v18.20.1 fixed a too-strict mypy version pin; v18.20.2 fixed circular imports in TypedDict definitions.
fix
Upgrade to 18.20.2: pip install kubernetes-typed==18.20.2
affects: >=18.20.0, <18.20.2
gotchaImport paths for Kubernetes models must follow the official kubernetes client paths (e.g., kubernetes.client.models.V1Deployment). Using kubernetes-typed does not change these paths.
fix
Use correct import: from kubernetes.client.models import V1Deployment
affects: all
Upgrade
Version history
18.20.2latest on PyPI · released Sep 2, 2024
Audit
Dependencies
kubernetesrequiredRequired runtime dependency; provides the Kubernetes client library that stubs target.
mypyrequiredRequired for type-checking; kubernetes-typed provides a mypy plugin.
Agent activity
29 hits · last 30 days
node
26
OpenAI (training)
1
Resources
kubernetes-typed — pip install kubernetes-typed · libregistry