Type stubs for the Kubernetes Python API client. This library provides static type checking for code interacting with the `kubernetes` client library. The version numbers of `kubernetes-stubs` generally track the upstream `kubernetes` client library. As of version 22.6.0.post1, it provides type definitions mirroring the API of the corresponding Kubernetes client version. Contributions and bug fixes are welcomed.
pip install kubernetes-stubsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the Kubernetes Python client and list all pods across all namespaces, benefiting from the type stubs for static analysis. It attempts to load configuration from a kubeconfig file (respecting KUBECONFIG environment variable) or falls back to in-cluster configuration.
Check the project's GitHub for latest releases or explore community-maintained forks like `kubernetes-stubs-elephant-fork` for newer Kubernetes client versions.
For advanced type-checking needs, especially with Custom Resources, investigate `kubernetes-typed` and its `mypy` plugin for enhanced capabilities.
Regularly consult the official Kubernetes API documentation for deprecation notices and update your code to use current API versions and fields.