mypy-boto3-amplifyuibuilder type annotations
This library provides type annotations for the `boto3` AWS SDK, specifically for the AmplifyUIBuilder service. It enables static type checking with tools like MyPy, Pyright, VSCode, and PyCharm, improving code quality and developer experience. The package is currently at version 1.42.3 and is generated by the `mypy-boto3-builder` (version 8.12.0), which follows a frequent release cadence tied to upstream `boto3` updates and builder improvements.
Warnings
- breaking Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0, which generates this package. Projects requiring Python 3.8 should use an older version of `mypy-boto3-amplifyuibuilder` or upgrade their Python environment.
- breaking The `mypy-boto3-builder` migrated to PEP 561 compliant packages in version 8.12.0. While this simplifies `mypy` integration, it might affect custom build processes or older tooling that relied on non-PEP 561 distribution methods.
- gotcha This package provides *only* type annotations. You must install `boto3` (and optionally `botocore`) separately for your application to function at runtime. Without `boto3`, your code will raise `ModuleNotFoundError`.
- gotcha For comprehensive type checking, especially when using `boto3.client()` or `boto3.resource()` without explicit type hints, it is recommended to install `boto3-stubs` with the appropriate service extras (e.g., `pip install 'boto3-stubs[amplifyuibuilder]'`). This provides overloads for the generic `boto3` functions.
- breaking The `mypy-boto3-builder` (version 8.9.0) introduced changes to TypeDef naming conventions, potentially shortening names or reordering suffixes for clarity (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). If you directly reference these generated TypeDefs in your code, they might have changed.
- gotcha When using `if TYPE_CHECKING:` guards to conditionally import stubs for Pylint compatibility, Pylint might report `undefined variable` errors in the `else` block. This is a known Pylint limitation.
Install
-
pip install mypy-boto3-amplifyuibuilder boto3 -
pip install 'boto3-stubs[amplifyuibuilder]' boto3
Imports
- AmplifyUIBuilderClient
from mypy_boto3_amplifyuibuilder.client import AmplifyUIBuilderClient
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_amplifyuibuilder.client import AmplifyUIBuilderClient
def get_amplifyuibuilder_client() -> AmplifyUIBuilderClient:
"""Gets a typed AmplifyUIBuilder client."""
client: AmplifyUIBuilderClient = boto3.client(
"amplifyuibuilder",
region_name="us-east-1"
)
return client
# Example usage (will be type-checked by MyPy)
if __name__ == "__main__":
try:
amplify_client = get_amplifyuibuilder_client()
# Replace with an actual AmplifyUIBuilder API call
# For example, listing components, if any exist
print(f"Client type: {type(amplify_client)}")
# Example: list components (requires valid AWS credentials and existing resources)
# response = amplify_client.list_components()
# print(f"Components: {response.get('entities')}")
print("AmplifyUIBuilder client initialized successfully. Further calls require valid AWS credentials and service usage.")
except Exception as e:
print(f"An error occurred: {e}")