types-boto3 provides comprehensive type annotations for the boto3, botocore, aiobotocore, and aioboto3 libraries. It significantly enhances development experience by enabling static type checking and providing intelligent code completion in IDEs like PyCharm and VSCode for AWS SDK for Python. The library is actively maintained and regularly updated to reflect the latest boto3 versions.
pip install types-boto3Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use type annotations for a boto3 S3 client. It explicitly imports the `S3Client` type from `types_boto3_s3.client` and `ListBucketsOutputTypeDef` for the response, enabling IDEs to provide code completion and static type checkers like MyPy to validate usage. Ensure `boto3` and `types-boto3[s3]` are installed.
Migrate to `types-boto3`. Replace `pip install boto3-type-annotations` with `pip install types-boto3` (or specific service extras) and update import statements (e.g., `from boto3_type_annotations.s3 import Client` to `from types_boto3_s3.client import S3Client`).
Replace `boto3-stubs` dependency with `types-boto3`. Update `mypy_boto3_<service>` imports to `types_boto3_<service>` (e.g., `from mypy_boto3_s3.client import S3Client` to `from types_boto3_s3.client import S3Client`).
It is recommended to use `types-boto3-lite` instead of `types-boto3` if PyCharm performance becomes an issue, especially with older PyCharm versions (before the underlying issue PY-40997 is fully resolved). `pip install types-boto3-lite`.
Instead of `pip install 'types-boto3[all]'`, install specific service packages like `pip install 'types-boto3[s3,ec2]'`. Each service has its own dedicated package (e.g., `types-boto3-s3`).