{"id":3081,"library":"mypy-boto3-eks","title":"Type Annotations for boto3 EKS","description":"mypy-boto3-eks provides high-quality type annotations for the boto3 EKS client and service-specific types, enabling static type checking with Mypy and enhancing IDE autocompletion. It is part of the larger `mypy-boto3` ecosystem, generated by `mypy-boto3-builder`. The current version is 1.42.85, and releases are frequent, typically tracking `boto3` versions closely.","status":"active","version":"1.42.85","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","mypy","aws","eks","types","stubs","type-hinting"],"install":[{"cmd":"pip install mypy-boto3-eks","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"Provides the actual AWS API client. This package provides type stubs for it.","package":"boto3","optional":true},{"reason":"The static type checker that consumes these type stubs.","package":"mypy","optional":true}],"imports":[{"symbol":"EKSClient","correct":"from mypy_boto3_eks.client import EKSClient"},{"symbol":"ListClustersResponseTypeDef","correct":"from mypy_boto3_eks.type_defs import ListClustersResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_eks.client import EKSClient\nfrom mypy_boto3_eks.type_defs import ListClustersResponseTypeDef\n\n# Initialize a Boto3 EKS client with type hinting from mypy-boto3-eks\nclient: EKSClient = boto3.client(\"eks\")\n\n# Call a client method and ensure the response is correctly typed\nresponse: ListClustersResponseTypeDef = client.list_clusters()\n\nprint(\"Found EKS clusters:\")\nfor cluster in response.get(\"clusters\", []):\n    print(f\"- {cluster['name']} (version: {cluster.get('version', 'N/A')})\")\n\n# mypy will now provide checks for attribute access and types\n# Example: if 'nextToken' is present, its type is known\nif 'nextToken' in response:\n    next_token: str = response['nextToken']\n    print(f\"Next Token: {next_token}\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-eks` to add type hints to your `boto3` EKS client interactions. It shows importing the `EKSClient` type and a response `TypeDef`, allowing Mypy to validate your code and IDEs to provide better autocompletion."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin `mypy-boto3-eks` to a version generated by builder < 8.12.0, which may mean using an older `boto3` version.","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates `mypy-boto3-eks` packages), Python 3.8 is no longer supported. Projects requiring type annotations for EKS must use Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 (builder), all generated packages from this builder version onwards"},{"fix":"Always install the `mypy-boto3` stub package version that matches your `boto3` runtime package version. E.g., `pip install boto3==1.42.85 mypy-boto3-eks==1.42.85`.","message":"The version of `mypy-boto3-eks` is closely tied to the `boto3` version it provides stubs for. Using mismatched versions (e.g., `mypy-boto3-eks==1.42.85` with `boto3==1.28.0`) can lead to Mypy errors or incorrect type hints.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If you explicitly import and use specific `TypeDef` classes in your type annotations, review your code after upgrading `mypy-boto3-eks` to ensure TypeDef names are still valid. Refer to the specific service's `type_defs.pyi` for current names.","message":"Internal type definition (TypeDef) names for request/response structures can change across major builder versions (e.g., `CreateDistributionRequestRequestTypeDef` becoming `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":">=8.9.0 (builder)"},{"fix":"Stay informed about `boto3` and AWS API changes. When upgrading `mypy-boto3-eks`, review relevant service documentation and update your code to reflect the latest API conventions. Mypy will help identify outdated calls.","message":"Service API changes in underlying `boto3` (e.g., service renames like `sms-voice` to `pinpoint-sms-voice` or changes in API parameters) are reflected in the stub packages. This can lead to type errors if your code calls deprecated or renamed methods/services.","severity":"gotcha","affected_versions":"All versions, whenever upstream `boto3` changes"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}