{"id":3009,"library":"mypy-boto3-amplify","title":"mypy-boto3-amplify Type Stubs for AWS Amplify","description":"mypy-boto3-amplify provides static type annotations for the AWS SDK for Python (boto3) specifically for the Amplify service. It helps improve code quality, enables better IDE autocompletion, and catches potential type-related errors before runtime. Currently at version 1.42.3, its releases are closely tied to boto3 updates, ensuring up-to-date type information generated by the mypy-boto3-builder.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","type-hints","mypy","stubs","static-analysis","amplify"],"install":[{"cmd":"pip install mypy-boto3-amplify","lang":"bash","label":"Install service stubs"},{"cmd":"pip install 'boto3-stubs[amplify]'","lang":"bash","label":"Install via boto3-stubs (recommended)"}],"dependencies":[{"reason":"Provides the AWS SDK runtime library that these stubs annotate.","package":"boto3"}],"imports":[{"note":"Type hint for the boto3 Amplify client.","symbol":"AmplifyClient","correct":"from mypy_boto3_amplify.client import AmplifyClient"},{"note":"Literal type for the 'amplify' service name.","symbol":"AmplifyServiceName","correct":"from mypy_boto3_amplify.literals import AmplifyServiceName"},{"note":"Type definition for the output of ListApps API call.","symbol":"ListAppsOutputTypeDef","correct":"from mypy_boto3_amplify.type_defs import ListAppsOutputTypeDef"},{"note":"Used for conditional imports to avoid runtime dependency on type stubs.","symbol":"TYPE_CHECKING","correct":"from typing import TYPE_CHECKING"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING, List\nimport os\n\nif TYPE_CHECKING:\n    from mypy_boto3_amplify.client import AmplifyClient\n    from mypy_boto3_amplify.type_defs import AppOutputTypeDef, ListAppsOutputTypeDef\n\ndef get_amplify_apps(client: 'AmplifyClient') -> List['AppOutputTypeDef']:\n    \"\"\"Lists Amplify applications with type hints.\"\"\"\n    response: 'ListAppsOutputTypeDef' = client.list_apps()\n    return response.get('apps', [])\n\n# Example usage\n# Ensure AWS credentials are set up (e.g., via environment variables or ~/.aws/credentials)\n# For a runnable example, we'll mock client creation\n\nif os.environ.get('AWS_ACCESS_KEY_ID'): # Check if credentials exist for a real client\n    amplify_client: 'AmplifyClient' = boto3.client('amplify')\n    apps = get_amplify_apps(amplify_client)\n    print(f\"Found {len(apps)} Amplify applications.\")\n    for app in apps:\n        print(f\"  - App ID: {app['appId']}, Name: {app['name']}\")\nelse:\n    print(\"AWS credentials not found. Skipping live client example. Define AWS_ACCESS_KEY_ID to run.\")\n\n# Without type checking (runtime code)\namplify_client_untyped = boto3.client('amplify')\n# This client would also work, but without static type validation.","lang":"python","description":"This example demonstrates how to obtain a type-hinted Amplify client using `boto3` and leverage the `mypy-boto3-amplify` stubs for static analysis. It includes a `TYPE_CHECKING` guard for conditional imports, ensuring the stubs are only used during type checking and not as a runtime dependency. The `get_amplify_apps` function is fully type-hinted, including the client and the return value based on `ListAppsOutputTypeDef`."},"warnings":[{"fix":"Upgrade your project's Python interpreter to 3.9 or newer.","message":"Python 3.8 support has been removed across all `mypy-boto3-*` packages. Projects using these stubs must target Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-amplify==1.42.3 and later (generated by mypy-boto3-builder 8.12.0+)"},{"fix":"Update your type annotations to reflect the new, shorter or reordered TypeDef names. Refer to the specific service's documentation for exact TypeDef names.","message":"TypeDef naming conventions have changed. For packed method arguments, `RequestRequestTypeDef` is shortened to `RequestTypeDef`. Conflicting `Extra` postfixes are moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-amplify==1.42.3 and later (generated by mypy-boto3-builder 8.9.0+)"},{"fix":"Migrate your code to use the `pinpoint-sms-voice` service and install `mypy-boto3-pinpoint-sms-voice` stubs if needed.","message":"The `sms-voice` service stubs have been removed as the service is no longer supported by AWS. Use `pinpoint-sms-voice` instead.","severity":"deprecated","affected_versions":"mypy-boto3-sms-voice (all versions generated by mypy-boto3-builder 8.11.0+)"},{"fix":"Ensure `mypy-boto3-amplify` is installed in the same environment as your project during development. No runtime changes are needed.","message":"These packages are PEP 561-compliant stub-only packages. They provide type information for `boto3` but do not contain any runtime code themselves. `mypy` and other type checkers automatically discover them if installed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement conditional type assignment: `if TYPE_CHECKING: from mypy_boto3_amplify.client import AmplifyClient else: AmplifyClient = object`","message":"When using `TYPE_CHECKING` guards for conditional imports, `pylint` may complain about undefined variables. To resolve this, conditionally set the imported types to `object` in the non-`TYPE_CHECKING` branch.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly add type hints such as `amplify_client: AmplifyClient = boto3.client('amplify')` to improve developer experience.","message":"While type checkers can often infer types, explicit type annotations for `boto3.client()`, `session.client()`, `client.get_waiter()`, and `client.get_paginator()` calls are highly recommended for optimal IDE autocompletion and type validation.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}