Registry / type-stubs / mypy-boto3

mypy-boto3

JSON →
library1.43.0pypypi✓ verified 26d ago

This package provides legacy type annotations for the `boto3` AWS SDK. As of version `1.42.3`, it is officially deprecated in favor of `types-boto3`. It enhances `boto3` code with static type checking capabilities (e.g., with MyPy) by providing a single package with stubs for all AWS services. The recommended successor, `types-boto3`, offers more granular, service-specific stub packages and is actively maintained.

pip install mypy-boto3 boto3
INSTALL
IMPORT
SIG · MYPY-BOTO3
M
mypy-boto3
type-stubspythonv1.43.0
Install
18.5s avg
Import
672ms
Disk
50MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.43.0 · 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
py 3.10–3.915 runs
installs and imports cleanly · install 0.0s · import 0.700s · 52MB
glibc
py 3.10–3.915 runs
installs and imports cleanly · install 22.2s · import 0.644s · 53MB
50MB installed
● package 50MB
Code
Verified usage

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

boto3.client
✓ import boto3 s3_client = boto3.client('s3')
mypy-boto3 is a stub package and not directly imported. Its presence enables type checking for standard boto3 imports.

This quickstart demonstrates how `mypy-boto3` (or its successor `types-boto3`) enhances standard `boto3` usage with type annotations. Installing the stubs allows static analysis tools like MyPy and IDEs to provide accurate type information, autocomplete, and error checking for `boto3` client methods and their responses.

import boto3 from typing import Optional def get_s3_bucket_location(bucket_name: str) -> Optional[str]: s3_client = boto3.client('s3') # The response type from get_bucket_location will be fully type-hinted response = s3_client.get_bucket_location(Bucket=bucket_name) location = response.get('LocationConstraint') return location # Example usage (requires AWS credentials configured and bucket to exist) # try: # # For a bucket like 'your-unique-test-bucket-123' # location = get_s3_bucket_location('your-unique-test-bucket-123') # if location is not None: # print(f"Bucket location: {location}") # else: # print("Bucket location is 'us-east-1' (default) or not set.") # except Exception as e: # print(f"Error fetching bucket location: {e}")
Debug
Known issues
breakingThe `mypy-boto3` package is officially deprecated and no longer actively maintained. Users are strongly advised to migrate to `types-boto3` and its service-specific sub-packages for current features, bug fixes, and active support.
fix
Uninstall `mypy-boto3` (`pip uninstall mypy-boto3`). Install `types-boto3` or specific service packages (e.g., `pip install types-boto3-s3`). Refer to `types-boto3` documentation for details.
affects: 1.x.x (all versions of mypy-boto3)
gotchaUnlike `mypy-boto3`, which provided all service stubs in a single package, `types-boto3` promotes a modular approach with separate packages for each AWS service (e.g., `types-boto3-s3`, `types-boto3-lambda`). This reduces dependency footprint and improves type checking performance but requires installing each service individually or using the `[all]` extra.
fix
Identify the specific AWS services your project uses and install only the corresponding `types-boto3-<service>` packages (e.g., `pip install types-boto3-s3 types-boto3-lambda`) or `pip install 'types-boto3[all]'` if all stubs are needed.
affects: 1.x.x (mypy-boto3 users migrating to types-boto3)
gotchaWhile `mypy-boto3` version 1.x.x itself requires Python `3.9` or newer, the successor `types-boto3` versions (8.12.0+) have explicitly dropped support for Python 3.8. Ensure your development and deployment environments are running Python 3.9 or newer to be compatible with `types-boto3`.
fix
Upgrade your Python environment to 3.9 or a newer version to maintain compatibility with the actively maintained `types-boto3` package line.
affects: 1.x.x (mypy-boto3 users considering or undergoing migration)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredRuntime dependency for type stubs; mypy-boto3 provides types for boto3.
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources