mypy-boto3-launch-wizard
mypy-boto3-launch-wizard provides type annotations for the `boto3` LaunchWizard service. It is currently at version 1.42.30 and is part of the `mypy-boto3` ecosystem, with new versions released regularly in sync with `boto3` updates, generated by `mypy-boto3-builder`.
Warnings
- breaking Python 3.8 support was removed for all `mypy-boto3` packages (including this one) as of `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older must upgrade their Python version.
- breaking Some TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. This can lead to breaking type check errors if you're using explicit TypeDef imports.
- gotcha Starting with `mypy-boto3-builder` 8.12.0, all generated packages migrated to PEP 561 (distribution of type information for Python packages). While this generally improves compatibility, it might require ensuring your type checkers (like mypy) are up-to-date and correctly configured to discover PEP 561 compliant stub packages.
- gotcha PyCharm users might experience slow performance and high CPU usage due to an issue with Literal overloads (issue PY-40997). It is recommended to use the `boto3-stubs-lite` version if available for the service or disable PyCharm's type checker and rely on `mypy`/`pyright` instead.
Install
-
pip install mypy-boto3-launch-wizard -
pip install 'boto3-stubs[launch-wizard]'
Imports
- LaunchWizardClient
from mypy_boto3_launch_wizard.client import LaunchWizardClient
- LaunchWizardServiceName
from mypy_boto3_launch_wizard.literals import LaunchWizardServiceName
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_launch_wizard.client import LaunchWizardClient
def get_launch_wizard_client() -> LaunchWizardClient:
"""Provides a type-hinted AWS LaunchWizard client."""
# boto3.client is dynamically typed, so explicit annotation is needed for mypy
client: LaunchWizardClient = boto3.client(
"launch-wizard",
region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1'),
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '')
)
return client
# Example usage:
if __name__ == "__main__":
import os
client = get_launch_wizard_client()
try:
# Replace with an actual LaunchWizard API call, e.g., listing deployments
# This will provide type hints for available methods and parameters
response = client.list_deployments()
print("Successfully retrieved LaunchWizard deployments (or similar call).")
print(f"Deployments: {response.get('deployments', [])}")
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure AWS credentials and region are configured.")