skillfed

kubernetes-typed

Collection of mypy plugins and stubs for kubernetes

kubernetes-typed v18.20.2 171.4K downloads/30d#10,367 on PyPI26
Permissive license Apache License Version 2.0 DORMANT released

What it is and what it does

kubernetes-typed is a mypy plugin that generates type definitions for Kubernetes objects at static analysis time. It works in two modes: it can type-check custom resource definitions by reading their YAML schemas and generating TypedDict types, or it can provide type stubs for the kubernetes-client library to enable type checking of standard Kubernetes objects. The plugin integrates directly into mypy's type-checking pipeline, allowing developers to catch type errors in Kubernetes manifests and client code before runtime.

The package depends on mypy, jsonschema, PyYAML, mypy-extensions, and jsonschema-typed-v2. It supports Python 3.8 through 3.12 and follows the kubernetes-client versioning scheme, so the MAJOR.MINOR version matches the client version for which stubs were generated. It is currently in beta and dormant—no active development is expected, though the repository is not archived.

Use it for:

  • Type-check custom resource definitions in YAML files to catch schema violations early in development
  • Enable IDE autocomplete and type hints when working with kubernetes-client library classes
  • Validate Kubernetes manifest dictionaries before submitting them to the API
  • Catch typos and incorrect field names in Pod, Deployment, and other standard resource specs
  • Enforce consistent typing across a team's Kubernetes automation and operator code

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A mypy plugin that adds type checking support for Kubernetes objects, including custom resource definitions and the kubernetes-client library.

Yes, if you use mypy for Python Kubernetes tooling and want type safety for manifests and client code. The low install friction and permissive license make it a straightforward addition to a mypy workflow. However, dormant maintenance and known limitations mean it is best suited for stable, non-bleeding-edge use cases. No known security vulnerabilities.

Install

kubernetes-typed on PyPI

pip

pip install kubernetes-typed

uv

uv add kubernetes-typed

poetry

poetry add kubernetes-typed

Installing kubernetes-typed

Before you install

Low install friction with a pure-wheel distribution. Maintenance is dormant—last release was 711 days ago, though the repository remains active with a recent commit on 2024-09-08. Suitable for stable use but expect no active development.

License in practice

Apache License Version 2.0 is permissive, allowing commercial and private use with minimal restrictions beyond attribution and liability disclaimers.

Quickstart

pip install kubernetes-typed

# Configure mypy to use the plugin:
# [mypy]
# plugins = kubernetes_typed.plugin

from kubernetes_typed.client import V1PodDict

pod_manifest: V1PodDict = {
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {"name": "test-pod"},
}

Requires mypy to be installed and configured; CRDs using additionalProperties are not supported.

Verify before relying

  • Whether the plugin works reliably with mypy versions beyond those tested during development
  • Performance impact when type-checking large numbers of custom resources
  • Compatibility with recent kubernetes-client library versions

Package facts

License Apache License Version 2.0 (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 5 — jsonschema-typed-v2, jsonschema, mypy, mypy-extensions, PyYAML
Maintenance dormant — 711 days since the last release
Last repo commit
First released
Downloads 171,421/month — #10,367 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: kubernetes_typed-18.20.2-py3-none-any.whl

Keywords: Kubernetes, MyPy, Stubs, Typing

Development Status :: 4 - BetaEnvironment :: ConsoleEnvironment :: PluginsIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software DevelopmentTyping :: Typed

Tags

kubernetes type checking mypymypy plugin kubernetescustom resource definition typingkubernetes python client typesk8s type stubskubernetes crd type hintsmypy kubernetes plugin
kubernetestype-checkingmypy-plugin

More Software Development packages