mypy-boto3-mwaa-serverless
This package provides type annotations for the `boto3` MWAA Serverless service, generated by `mypy-boto3-builder`. It enhances type checking for `boto3` users, allowing tools like MyPy to validate usage of the `mwaa-serverless` client. The library follows a frequent release cadence, typically updated with new `boto3` versions and `mypy-boto3-builder` enhancements.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. All `mypy-boto3-*` packages, including `mypy-boto3-mwaa-serverless`, now require Python >= 3.9.
- breaking TypeDef names for packed method arguments were shortened in `mypy-boto3-builder` version 8.9.0. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. Additionally, the `Extra` postfix for conflicting TypeDefs moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`).
- breaking `mypy-boto3-builder` migrated to PEP 561 compliant packages in version 8.12.0. This change affects how type checkers discover and interact with the type stubs, potentially requiring minor adjustments in build systems or type checker configurations, especially for advanced use cases.
- gotcha This package provides *only* type stubs. For actual runtime execution, you must also install the `boto3` library. The stubs work by providing type hints for `boto3`'s dynamically typed clients.
Install
-
pip install mypy-boto3-mwaa-serverless boto3 mypy
Imports
- MWAAServerlessClient
from mypy_boto3_mwaa_serverless.client import MWAAServerlessClient
- CreateEnvironmentRequestTypeDef
from mypy_boto3_mwaa_serverless.type_defs import CreateEnvironmentRequestTypeDef
Quickstart
import boto3
from mypy_boto3_mwaa_serverless.client import MWAAServerlessClient
from typing import TYPE_CHECKING
# This block is for type-checking only, for documentation of what types are available
if TYPE_CHECKING:
# Example of importing a specific TypeDef for request/response structures
from mypy_boto3_mwaa_serverless.type_defs import ListEnvironmentsResponseTypeDef
def get_mwaa_client() -> MWAAServerlessClient:
"""
Returns a type-hinted MWAA Serverless client using boto3.
"""
# 'mwaa-serverless' is the correct service name for boto3 client creation
return boto3.client("mwaa-serverless")
def list_mwaa_environments(client: MWAAServerlessClient) -> None:
"""
Lists MWAA Serverless environments with type annotations.
"""
# The client method call itself is from boto3, type-checked by mypy-boto3-mwaa-serverless
response: ListEnvironmentsResponseTypeDef = client.list_environments()
print("MWAA Environments:")
for env in response.get('Environments', []):
print(f" - Name: {env.get('Name')}, Status: {env.get('Status')}")
if __name__ == "__main__":
# Ensure AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)
mwaa_client = get_mwaa_client()
list_mwaa_environments(mwaa_client)