{"id":5085,"library":"types-boto3-iam","title":"Type Annotations for Boto3 IAM","description":"types-boto3-iam provides comprehensive type annotations for the AWS Identity and Access Management (IAM) service client within the `boto3` library. This package is generated by `mypy-boto3-builder` and aims to enhance static analysis, autocompletion, and error detection in IDEs and linters like MyPy and Pyright, ensuring type safety for `boto3` IAM operations. It is actively maintained with frequent updates reflecting `boto3` versions.","status":"active","version":"1.42.64","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","iam","typing","stubs","mypy","pyright"],"install":[{"cmd":"pip install types-boto3-iam","lang":"bash","label":"Standalone package"},{"cmd":"pip install 'types-boto3[iam]'","lang":"bash","label":"As part of types-boto3 meta-package"}],"dependencies":[{"reason":"Provides the runtime functionality that these types annotate. This stub package does not install boto3 itself.","package":"boto3","optional":false},{"reason":"Requires Python 3.9 or higher.","package":"python","optional":false}],"imports":[{"note":"For explicit type hinting of the IAM client.","symbol":"IAMClient","correct":"from types_boto3_iam import IAMClient"},{"note":"For explicit type hinting of the IAM service resource.","symbol":"IAMServiceResource","correct":"from types_boto3_iam import IAMServiceResource"},{"note":"For explicit type hinting of specific TypeDefs (data structures).","symbol":"CreateUserRequestRequestTypeDef","correct":"from types_boto3_iam.type_defs import CreateUserRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom boto3.session import Session\nfrom types_boto3_iam import IAMClient\n\n# Instantiate a boto3 session and client\nsession: Session = boto3.session.Session()\niam_client: IAMClient = session.client(\"iam\")\n\n# Example usage with type-hinted client\n# (Note: In a real scenario, use proper error handling and credential management)\ntry:\n    response = iam_client.list_users(MaxItems=1)\n    for user in response.get('Users', []):\n        print(f\"IAM User: {user['UserName']} (ARN: {user['Arn']})\")\nexcept Exception as e:\n    print(f\"Error listing users: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize an IAM client with type annotations using `types-boto3-iam`. The `IAMClient` type ensures that `iam_client` methods and their arguments/return values are checked by your static type checker, providing autocompletion and early error detection."},"warnings":[{"fix":"Upgrade to Python 3.9 or newer.","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates these stubs), Python 3.8 is no longer supported. Users on Python 3.8 should upgrade their Python version or use an older stub version.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0 (and generated types-boto3-iam versions)"},{"fix":"Review explicit TypeDef imports and update names according to the new conventions.","message":"Version 8.9.0 of `mypy-boto3-builder` introduced breaking changes in TypeDef naming conventions, potentially affecting explicit imports of generated type definitions (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0 (and generated types-boto3-iam versions)"},{"fix":"Ensure `types-boto3-iam` is installed in your development environment when `boto3` is used.","message":"These are separate stub packages; `boto3` itself does not include these type annotations. You must install `types-boto3-iam` alongside `boto3` for type checking to function correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Wrap type-only imports with `from typing import TYPE_CHECKING; if TYPE_CHECKING: ...` to avoid Pylint warnings in runtime environments.","message":"When using Pylint, it might complain about undefined variables if types-boto3-iam is imported only for type checking. A common workaround is to use a `if TYPE_CHECKING:` guard.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install `types-boto3-lite-iam` or `types-boto3-lite[iam]` instead of the full package, and use explicit type hints where auto-discovery causes performance issues.","message":"PyCharm users might experience slow performance with Literal overloads. For better IDE performance, consider using `types-boto3-lite` variants (e.g., `types-boto3-lite-iam`) if explicit type annotations are acceptable.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}