mypy-boto3-simpledbv2
mypy-boto3-simpledbv2 provides precise type annotations for the boto3 SimpleDBv2 client, enhancing type checking for AWS SDK usage. It is part of the `mypy-boto3` project, which generates stubs for all boto3 services. The current version is 1.42.66, and it updates frequently, typically in sync with `boto3` and `botocore` releases.
Warnings
- breaking As of `mypy-boto3-builder` version 8.12.0 (which generated this package version), Python 3.8 support has been dropped. All `mypy-boto3` packages now require Python 3.9 or higher.
- breaking Beginning with `mypy-boto3-builder` version 8.9.0, some TypeDef naming conventions were changed (e.g., `CreateDistributionRequestRequestTypeDef` might become `CreateDistributionRequestTypeDef`). While the specific example is for a different service, this is a builder-wide change that may affect explicit type annotations in your code for SimpleDBv2 request/response payloads.
- gotcha This package only provides type stubs. You must install `boto3` separately for actual AWS API calls. This package does not install `boto3` as a dependency.
- gotcha Each AWS service requires its own `mypy-boto3-<service-name>` package for comprehensive type checking. Installing `mypy-boto3-simpledbv2` only provides types for SimpleDBv2, not other services like S3 or EC2.
- gotcha As of `mypy-boto3-builder` version 8.12.0, all packages migrated to PEP 561 compliance. This means `mypy` should automatically discover the type stubs without explicit configuration in `mypy.ini` (e.g., `plugins`). If you have old `mypy.ini` configurations for `mypy-boto3` plugins, they might now cause issues.
Install
-
pip install mypy-boto3-simpledbv2
Imports
- SimpleDBv2Client
from boto3.client import SimpleDBv2Client
from mypy_boto3_simpledbv2.client import SimpleDBv2Client
- CreateDomainRequestTypeDef
from mypy_boto3_simpledbv2.type_defs import CreateDomainRequestTypeDef
- ClientError
from botocore.exceptions import ClientError
Quickstart
import boto3
from mypy_boto3_simpledbv2.client import SimpleDBv2Client
from botocore.exceptions import ClientError
def list_simpledb_domains():
"""Lists SimpleDB domains using a typed boto3 client."""
try:
# Initialize a typed SimpleDBv2 client
client: SimpleDBv2Client = boto3.client("sdb")
# List domains with type-hinted response
response = client.list_domains(MaxNumberOfDomains=10)
print(f"SimpleDB Domains: {response.get('DomainNames', [])}")
if response.get("NextToken"):
print("More domains available (use NextToken).")
except ClientError as e:
print(f"Error listing SimpleDB domains: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
# Ensure AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)
list_simpledb_domains()