mypy-boto3-license-manager Type Stubs for Boto3
mypy-boto3-license-manager provides type annotations (stubs) for the `boto3` AWS SDK's LicenseManager service. It enables static type checking for `boto3` code interacting with License Manager, helping developers catch type-related errors before runtime. This package is part of the `mypy-boto3` ecosystem, generated by `mypy-boto3-builder`. The current version is 1.42.3, closely aligned with `boto3` releases and updated frequently.
Warnings
- breaking Python 3.8 support has been removed across the `mypy-boto3` ecosystem. This package, if generated by `mypy-boto3-builder` v8.12.0 or later, will not support Python 3.8.
- breaking TypeDef naming conventions changed in builder version 8.9.0. This includes shortening names for packed method arguments (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving 'Extra' postfixes to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).
- gotcha This package (`mypy-boto3-license-manager`) provides type stubs *only* for the LicenseManager service. If you need type annotations for other AWS services (e.g., S3, EC2), you must install their respective `mypy-boto3-SERVICE_NAME` packages. Installing `mypy-boto3` directly will install stubs for all services.
Install
-
pip install mypy-boto3-license-manager
Imports
- LicenseManagerClient
from mypy_boto3_license_manager.client import LicenseManagerClient
- LicenseConfigurationTypeDef
from mypy_boto3_license_manager.type_defs import LicenseConfigurationTypeDef
- ListLicenseConfigurationsRequestRequestTypeDef
from mypy_boto3_license_manager.type_defs import ListLicenseConfigurationsRequestRequestTypeDef
Quickstart
import boto3
from mypy_boto3_license_manager.client import LicenseManagerClient
from mypy_boto3_license_manager.type_defs import (
LicenseConfigurationTypeDef,
ListLicenseConfigurationsRequestRequestTypeDef
)
import os
def get_license_configurations(region: str) -> list[LicenseConfigurationTypeDef]:
# It's crucial to explicitly cast the client for mypy to pick up the types
client: LicenseManagerClient = boto3.client("license-manager", region_name=region)
# Example of using a TypedDict for a request payload
request: ListLicenseConfigurationsRequestRequestTypeDef = {
"MaxResults": 5,
}
response = client.list_license_configurations(**request)
return response.get("LicenseConfigurations", [])
if __name__ == "__main__":
# Example usage - ensure AWS credentials are configured (e.g., via env vars or ~/.aws/credentials)
# mypy will check this code for type consistency at compile time
# actual runtime execution requires valid AWS credentials and region.
aws_region = os.environ.get('AWS_REGION_NAME', 'us-east-1')
print(f"Fetching License Manager configurations in region: {aws_region}")
try:
configurations = get_license_configurations(aws_region)
if configurations:
for config in configurations:
print(f" ARN: {config.get('LicenseConfigurationArn')}, Name: {config.get('LicenseConfigurationName')}")
else:
print(" No license configurations found.")
except Exception as e:
print(f"Error fetching configurations: {e}")