{"id":3023,"library":"mypy-boto3-apprunner","title":"Type annotations for boto3 AppRunner","description":"mypy-boto3-apprunner provides type annotations for the AWS AppRunner service client, compatible with boto3 version 1.42.3. It is generated by the `mypy-boto3-builder` and is part of a larger ecosystem providing comprehensive type hints for `boto3`, `botocore`, `aiobotocore`, and `aioboto3`. The project is actively maintained with regular updates to reflect changes in `boto3` and Python typing standards.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","apprunner","stubs","type-checking"],"install":[{"cmd":"pip install boto3 mypy mypy-boto3-apprunner","lang":"bash","label":"Install boto3, mypy, and AppRunner stubs"}],"dependencies":[{"reason":"This package provides type stubs for the `boto3` library; `boto3` itself is required at runtime.","package":"boto3"},{"reason":"This library is designed for static type checking with `mypy`.","package":"mypy"},{"reason":"May be a transitive dependency for older Python versions, though current versions often target >=3.9 which includes many typing features.","package":"typing-extensions","optional":true}],"imports":[{"note":"Client types are provided by `mypy-boto3-apprunner`, not directly from `boto3` or `botocore`.","wrong":"from boto3.client import AppRunner","symbol":"AppRunnerClient","correct":"from mypy_boto3_apprunner.client import AppRunnerClient"},{"note":"Specific type definitions (TypedDicts) are imported from the `mypy_boto3_apprunner.type_defs` submodule.","wrong":"from boto3.apprunner.type_defs import ServiceSummaryTypeDef","symbol":"ServiceSummaryTypeDef","correct":"from mypy_boto3_apprunner.type_defs import ServiceSummaryTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_apprunner.client import AppRunnerClient\n    from mypy_boto3_apprunner.type_defs import ServiceSummaryTypeDef\n\n\ndef get_apprunner_services() -> list['ServiceSummaryTypeDef']:\n    client: AppRunnerClient = boto3.client(\"apprunner\")\n    response = client.list_services(\n        MaxResults=5, \n        NextToken=None # Use actual token for pagination in real apps\n    )\n    return response.get(\"ServiceSummaryList\", [])\n\n\nif __name__ == \"__main__\":\n    # This code block will run at runtime, but only if boto3 is configured.\n    # For type checking, mypy will use the stubs.\n    # Ensure AWS credentials are set up (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME env vars)\n    # or ~/.aws/credentials and ~/.aws/config\n    try:\n        services = get_apprunner_services()\n        print(f\"Found {len(services)} AppRunner services:\")\n        for service in services:\n            print(f\"  - {service['ServiceName']} (Status: {service['Status']})\")\n    except Exception as e:\n        print(f\"Error fetching AppRunner services: {e}\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-apprunner` to provide type hints for the AppRunner client. It fetches a list of AppRunner services, leveraging the `AppRunnerClient` type for autocompletion and static analysis. The `TYPE_CHECKING` guard ensures the type-only imports don't introduce runtime dependencies."},"warnings":[{"fix":"Upgrade Python to 3.9 or newer.","message":"Python 3.8 support was removed starting with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older will need to upgrade their Python version to use recent `mypy-boto3` packages.","severity":"breaking","affected_versions":">= 8.12.0 of mypy-boto3-builder (and generated packages)"},{"fix":"Update imports and references to TypeDefs according to the new naming conventions. Use IDE autocompletion to find the correct names.","message":"The `mypy-boto3-builder` version 8.9.0 introduced breaking changes to generated TypeDef names. Specifically, arguments for methods may use shorter names, and 'Extra' postfixes were moved to the end of conflicting TypeDef names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). If you were directly referencing generated TypeDef names, these might have changed.","severity":"breaking","affected_versions":">= 8.9.0 of mypy-boto3-builder (and generated packages)"},{"fix":"Always explicitly type-hint your `boto3` client variables, e.g., `client: AppRunnerClient = boto3.client('apprunner')`.","message":"While `boto3-stubs` (the umbrella project) offers implicit type annotations, explicit type annotations for `boto3.client` and `boto3.session.client` calls are often recommended for the best experience with IDEs (like VSCode, PyCharm) and strict `mypy` configurations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `boto3` is installed alongside `mypy-boto3-apprunner` (e.g., `pip install boto3 mypy-boto3-apprunner`).","message":"This package provides *type annotations* for `boto3`'s AppRunner client. It does not include `boto3` itself. You must install `boto3` separately for your code to run at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement an `else` branch in `if TYPE_CHECKING:` blocks to assign `object` to your type aliases (e.g., `else: AppRunnerClient = object`).","message":"When using `if TYPE_CHECKING:` to conditionally import type hints, `pylint` may incorrectly report 'undefined variable' warnings. This can be mitigated by assigning `object` to the type aliases in the `else` branch.","severity":"gotcha","affected_versions":"All versions (when using `pylint` with conditional imports)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}