Registry / type-stubs / mypy-boto3-iam

mypy-boto3-iam

JSON →
library1.42.64pypypiunverified

mypy-boto3-iam provides static type annotations for the boto3 IAM service client, resources, and related types. It enables type checking with tools like MyPy, Pyright, and enhances IDE auto-completion for `boto3.client('iam')` calls. Currently at version 1.42.64, it is part of the frequently updated `mypy-boto3-builder` ecosystem, with releases often tied to new boto3 versions.

type-stubsaws
pip install mypy-boto3-iam
Install & Compatibility
Where this runs
tested against v1.43.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
glibc
py 3.10
8/10 runs
8/10 runs
py 3.11
8/10 runs
8/10 runs
py 3.12
8/10 runs
8/10 runs
py 3.13
8/10 runs
8/10 runs
py 3.9
8/10 runs
8/10 runs
Code
Verified usage

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

IAMClient
from mypy_boto3_iam import IAMClient
from mypy_boto3_iam import IAMClient
IAMServiceResource
from mypy_boto3_iam import IAMServiceResource
ServiceResource
from mypy_boto3_iam import ServiceResource

This quickstart demonstrates how to obtain a type-hinted IAM client using `mypy-boto3-iam` and call a method like `get_account_summary`. The `TYPE_CHECKING` block ensures type imports are only active during type checking, avoiding runtime dependencies if desired. For full type coverage, ensure `boto3` is also installed in your environment.

from typing import TYPE_CHECKING import boto3 if TYPE_CHECKING: from mypy_boto3_iam.client import IAMClient from mypy_boto3_iam.type_defs import GetAccountSummaryResponseTypeDef def get_iam_account_summary() -> 'GetAccountSummaryResponseTypeDef': # The 'iam' client is type-hinted by mypy-boto3-iam after installation. client: IAMClient = boto3.client("iam") summary = client.get_account_summary() print(f"IAM Account Summary: {summary['SummaryMap']}") return summary if __name__ == "__main__": # Ensure AWS credentials are configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN env vars or ~/.aws/credentials) try: get_iam_account_summary() except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingSupport for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0 and subsequent generated packages, including `mypy-boto3-iam`. The minimum required Python version is now 3.9.
fix
Upgrade your Python environment to 3.9 or newer.
affects: >=8.12.0
breakingIn `mypy-boto3-builder` version 8.9.0, type definition names for packed method arguments (`RequestRequestTypeDef` became `RequestTypeDef`) and conflicting `Extra` postfixes (`ExtraRequestTypeDef` became `RequestExtraTypeDef`) were changed. This may break existing type annotations.
fix
Update your custom type aliases or explicit type annotations to match the new naming conventions, or regenerate stubs if using `mypy-boto3-builder` locally.
affects: >=8.9.0
deprecatedThe `sms-voice` service stubs were removed in `mypy-boto3-builder` version 8.11.0 because the service is no longer supported by AWS. Use `pinpoint-sms-voice` stubs instead. While not directly IAM, this indicates a broader trend in the `mypy-boto3` ecosystem.
fix
Migrate any usage of `sms-voice` related stubs to `pinpoint-sms-voice` stubs.
affects: >=8.11.0
gotchaPyCharm users might experience slow performance or high CPU usage due to how PyCharm handles `Literal` overloads. It is recommended to use `boto3-stubs-lite` (e.g., `pip install 'boto3-stubs-lite[iam]'`) or disable PyCharm's type checker and rely on `mypy` or `pyright`.
fix
Consider installing `boto3-stubs-lite[iam]` for improved performance in PyCharm, or configure PyCharm to use external type checkers like MyPy or Pyright.
affects: all
gotchaWhen using standalone packages like `mypy-boto3-iam` or `boto3-stubs-lite`, you might need to explicitly annotate the client, resource, waiter, or paginator variables for full type checking and IDE auto-completion, as automatic type inference for `session.client()` overloads is not always available.
fix
Explicitly add type annotations, e.g., `client: IAMClient = session.client("iam")`.
affects: all
gotchaWhen using `mypy-boto3-iam` or other `mypy-boto3` stubs in a production environment where you want to avoid installing the stubs at runtime, wrap your type imports in a `if TYPE_CHECKING:` block. This prevents unnecessary runtime dependencies but requires setting types to `object` outside of type checking for tools like Pylint.
fix
Use `from typing import TYPE_CHECKING; if TYPE_CHECKING: from mypy_boto3_iam.client import IAMClient` and define a fallback `IAMClient = object` for runtime.
affects: all
breaking`mypy-boto3-iam` provides type stubs for `boto3`, but it does not install `boto3` itself. You must install `boto3` separately (e.g., `pip install boto3`) to use the library at runtime.
fix
Install the core boto3 library: 'pip install boto3'.
affects: all
breaking`mypy-boto3-iam` provides type stubs for `boto3`, but it does not install `boto3` itself. You must install `boto3` separately (e.g., `pip install boto3`) for your application to run.
fix
Install `boto3` explicitly (e.g., `pip install boto3`).
affects: all
Upgrade
Version history
1.43.2latest on PyPI
Audit
Dependencies
boto3requiredRuntime dependency for the AWS SDK, these are type stubs for it.
mypyoptionalRequired for static type checking; this package provides the type hints.
typing-extensionsoptionalMay be a dependency for older Python versions to backport typing features, automatically set by builder.
Agent activity
52 hits · last 30 days
node
4
seranking-bot
3
ahrefsbot
2
Amazon
1
Resources