Install & Compatibility
Where this runs
tested against v1.43.73 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.8s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ECRClient
✓ from mypy_boto3_ecr import ECRClient
✗ from mypy_boto3_ecr import ECRClient
This example demonstrates how to use `mypy-boto3-ecr` to type hint a `boto3` ECR client. It lists your ECR repositories, showing how the `ECRClient` type ensures correct method calls and access to response dict keys.
import boto3
from mypy_boto3_ecr import ECRClient
def list_ecr_repos(ecr_client: ECRClient) -> None:
"""Lists ECR repositories with type hints."""
print(f"Listing ECR repositories in region {ecr_client.meta.region_name}:")
try:
response = ecr_client.describe_repositories()
repositories = response.get('repositories', [])
if repositories:
for repo in repositories:
print(f"- {repo['repositoryName']} (URI: {repo['repositoryUri']})")
else:
print("No ECR repositories found.")
except Exception as e:
print(f"Error listing repositories: {e}")
if __name__ == "__main__":
# Ensure AWS credentials are configured (e.g., via ~/.aws/credentials or env vars)
# The actual client object comes from boto3, mypy-boto3-ecr provides the type annotation.
ecr_client: ECRClient = boto3.client(
"ecr",
region_name="us-east-1",
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '')
)
list_ecr_repos(ecr_client)
Debug
Known issues
breakingPython 3.8 is no longer supported for any `mypy-boto3` packages, including `mypy-boto3-ecr`, as of `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to upgrade to Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or a later version.
affects: mypy-boto3-builder>=8.12.0, mypy-boto3-ecr>=1.42.86
gotchaThis package only provides type stubs. You must install `boto3` separately for runtime functionality. `mypy-boto3-ecr` does not include the AWS SDK itself.fixEnsure `pip install boto3` is executed in your environment alongside `pip install mypy-boto3-ecr`.
affects: All versions
gotchaType stubs are generated for specific `boto3` and `botocore` versions. Mismatches between your installed `boto3` version and the `mypy-boto3-ecr` stubs can lead to incorrect type checking or missing attributes/methods. It's recommended to keep `boto3` and `mypy-boto3-ecr` versions as close as possible.fixPeriodically update both `boto3` and `mypy-boto3-ecr` (`pip install --upgrade boto3 mypy-boto3-ecr`). Check the `mypy-boto3-builder` release notes for details on which `boto3` version a stub release targets.
affects: All versions
breakingAs of `mypy-boto3-builder` 8.9.0, some `TypeDef` names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). If you manually referenced these types, your code might break.fixUpdate `TypeDef` references in your code to match the new shorter names by inspecting the `.type_defs` module or referring to the `mypy-boto3` documentation.
affects: mypy-boto3-builder>=8.9.0, mypy-boto3-ecr>=1.42.x (corresponding to builder v8.9.0+)
Upgrade
Version history
1.43.73latest on PyPI · released Aug 17, 2026
Audit
Dependencies
boto3requiredProvides the runtime functionality for which these are type stubs. It must be installed separately.
typing-extensionsoptionalRequired for full type hint compatibility on Python versions older than 3.11, especially for `NotRequired` and `TypeAlias`.