{"id":3359,"library":"mypy-boto3-ecr-public","title":"mypy-boto3-ecr-public Type Annotations","description":"mypy-boto3-ecr-public provides static type annotations for the boto3 ECR Public service. It's part of the `boto3-stubs` project, generated by `mypy-boto3-builder` version 8.12.0, ensuring compatibility with boto3 1.42.3. The library enables robust type checking with tools like mypy and pyright, and enhances IDE features such as auto-completion and type hints for AWS service clients. It is actively maintained with releases frequently synchronized with boto3 updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","typing","stubs","ecr-public","type-annotations"],"install":[{"cmd":"pip install mypy-boto3-ecr-public","lang":"bash","label":"Install standalone package"},{"cmd":"pip install 'boto3-stubs[ecr-public]'","lang":"bash","label":"Install as part of boto3-stubs"}],"dependencies":[{"reason":"The runtime library for which these are type stubs. Required for actual execution of AWS calls.","package":"boto3","optional":true},{"reason":"Core components for boto3 type stubs, installed automatically with mypy-boto3-ecr-public.","package":"boto3-stubs-core","optional":false}],"imports":[{"note":"The type stubs are provided by the mypy_boto3_ecr_public package, not directly by boto3 itself. While boto3.client(\"ecr-public\") works at runtime, for type checking you explicitly import the stub client type.","wrong":"from boto3.client import ECRPublicClient","symbol":"ECRPublicClient","correct":"from mypy_boto3_ecr_public.client import ECRPublicClient"},{"note":"Import specific paginator types for type hinting.","symbol":"DescribeImageTagsPaginator","correct":"from mypy_boto3_ecr_public.paginator import DescribeImageTagsPaginator"},{"note":"Import specific TypedDicts for request/response bodies.","symbol":"RepositoryScanningConfigurationFailureTypeDef","correct":"from mypy_boto3_ecr_public.type_defs import RepositoryScanningConfigurationFailureTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_ecr_public.client import ECRPublicClient\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    # Only import for type checking, avoid runtime dependency if not strictly needed\n    # Or, rely on the installed mypy-boto3-ecr-public for runtime type discovery\n    pass\n\ndef list_public_repositories(region: str = \"us-east-1\") -> None:\n    client: ECRPublicClient = boto3.client(\"ecr-public\", region_name=region)\n    try:\n        response = client.describe_repositories()\n        print(f\"Public ECR Repositories in {region}:\")\n        for repo in response.get(\"repositories\", []):\n            print(f\"  - {repo['repositoryName']} (URI: {repo['repositoryUri']})\")\n    except Exception as e:\n        print(f\"Error listing repositories: {e}\")\n\nif __name__ == \"__main__\":\n    # Note: AWS credentials (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)\n    # or ~/.aws/credentials are required for boto3 to function.\n    list_public_repositories()\n","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-ecr-public` to get type annotations for the ECR Public client and list public repositories. It shows explicit type hinting for the boto3 client."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Support for Python 3.8 and older versions has been removed. The library now requires Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder 8.12.0 and later (which generates mypy-boto3-ecr-public 1.42.3+)"},{"fix":"Update your type checker (e.g., mypy, pyright) to the latest version and verify your configuration. No direct code change is typically required unless you had custom type-stub handling.","message":"The package structure has migrated to PEP 561 compliance. While this generally improves compatibility, ensure your type checker is up-to-date and configured correctly.","severity":"breaking","affected_versions":"mypy-boto3-builder 8.12.0 and later"},{"fix":"Review and update `TypedDict` imports and usage in your code if you were relying on specific generated TypeDef names.","message":"TypeDef naming conventions for packed method arguments and conflicting names have changed. For example, `CreateDistributionRequestRequestTypeDef` might become `CreateDistributionRequestTypeDef`, and `Extra` postfixes were moved.","severity":"breaking","affected_versions":"mypy-boto3-builder 8.9.0 and later"},{"fix":"Ensure `boto3` is installed in your environment alongside `mypy-boto3-ecr-public`.","message":"This library provides *type stubs* only. You must also install `boto3` (e.g., `pip install boto3`) for your code to run at runtime and interact with AWS.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider `pip install boto3-stubs-lite[ecr-public]` for a lighter version, or configure PyCharm to use external type checkers like mypy/pyright instead of its built-in one for this library.","message":"PyCharm users might experience slow performance or high CPU usage due to Literal overloads. The project maintainers recommend using `boto3-stubs-lite` or disabling PyCharm's type checker in such cases.","severity":"gotcha","affected_versions":"All versions with PyCharm"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}