{"id":3144,"library":"mypy-boto3-sesv2","title":"Mypy Boto3 SESV2","description":"mypy-boto3-sesv2 provides comprehensive type annotations for the AWS boto3 SESV2 (Simple Email Service v2) client, paginators, and waiters. It allows developers to leverage static type checking with Mypy for their boto3 code, improving code quality and catching potential errors early. The library is updated frequently, often alongside new boto3/botocore releases and builder improvements, ensuring up-to-date and accurate type definitions. Current version: 1.42.63.","status":"active","version":"1.42.63","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","ses","email","sesv2"],"install":[{"cmd":"pip install mypy-boto3-sesv2 boto3","lang":"bash","label":"Install with boto3"},{"cmd":"pip install 'mypy-boto3-sesv2[essential]' boto3","lang":"bash","label":"Install essential with boto3"}],"dependencies":[{"reason":"Provides the runtime functionality that these stubs type-check.","package":"boto3","optional":false},{"reason":"Required for static type checking.","package":"mypy","optional":true}],"imports":[{"note":"Client types are provided by the stub package, not directly by boto3.","wrong":"from boto3.client import SESV2Client","symbol":"SESV2Client","correct":"from mypy_boto3_sesv2.client import SESV2Client"},{"note":"Type definitions for service requests/responses are found in type_defs.","symbol":"SendEmailRequestRequestTypeDef","correct":"from mypy_boto3_sesv2.type_defs import SendEmailRequestRequestTypeDef"},{"note":"Paginator types are available for methods that support pagination.","symbol":"Paginator","correct":"from mypy_boto3_sesv2.paginator import ListConfigurationSetsPaginator"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_sesv2.client import SESV2Client\nfrom mypy_boto3_sesv2.type_defs import SendEmailRequestRequestTypeDef\nimport os\n\n# Initialize a boto3 client with type hints\nclient: SESV2Client = boto3.client(\n    \"sesv2\",\n    region_name=os.environ.get('AWS_REGION', 'us-east-1')\n)\n\n# Example: Sending a simple email with type-checked arguments\nrequest_params: SendEmailRequestRequestTypeDef = {\n    \"FromEmailAddress\": \"sender@example.com\", # Replace with a verified sender\n    \"Destination\": {\n        \"ToAddresses\": [\n            \"recipient@example.com\" # Replace with a recipient\n        ]\n    },\n    \"Content\": {\n        \"Simple\": {\n            \"Subject\": {\"Data\": \"Hello from mypy-boto3-sesv2!\"},\n            \"Body\": {\"Text\": {\"Data\": \"This is a test email sent with SESv2.\"}}\n        }\n    }\n}\n\ntry:\n    response = client.send_email(**request_params)\n    print(f\"Email sent successfully! Message ID: {response['MessageId']}\")\nexcept Exception as e:\n    print(f\"Error sending email: {e}\")\n\n# Example: Listing configuration sets using a paginator\npaginator = client.get_paginator(\"list_configuration_sets\")\nfor page in paginator.paginate():\n    for config_set in page.get(\"ConfigurationSets\", []):\n        print(f\"Configuration Set: {config_set['ConfigurationSetName']}\")","lang":"python","description":"This quickstart demonstrates how to initialize an SESV2 client with `mypy-boto3-sesv2` type annotations and perform a `send_email` operation using type-checked arguments. It also shows how to use a paginator for listing resources. Remember to replace placeholder email addresses and ensure your AWS credentials and region are configured."},"warnings":[{"fix":"Upgrade to Python 3.9+ or pin `mypy-boto3-sesv2<8.12.0` in your project's dependencies.","message":"Python 3.8 support was removed and packages migrated to PEP 561. If you are on Python 3.8, you must pin to a version older than 8.12.0.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Review your code for direct references to generated TypeDef names and update them according to the new conventions (typically by removing redundant `Request` or `Response` suffixes if they were duplicated).","message":"TypeDef naming conventions changed in version 8.9.0 (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Code that directly imports or references specific generated type definition names may break.","severity":"breaking","affected_versions":">=8.9.0"},{"fix":"Verify `mypy` setup. Common fixes include `pip install mypy` in the project's virtual environment and running `mypy your_module.py`.","message":"The `mypy` tool must be configured to find the stubs. Ensure `mypy-boto3-sesv2` is installed in the same environment where `mypy` is run, or that your `mypy` configuration (e.g., `mypy.ini`) correctly includes the stub paths.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the `mypy-boto3-builder` changelog or PyPI for the correct service stub name. If a service is deprecated, migrate to its replacement.","message":"AWS services can be renamed or deprecated (e.g., 'sms-voice' to 'pinpoint-sms-voice' in 8.11.0). If you encounter `ModuleNotFoundError` for a service stub, check the official `mypy-boto3-builder` repository for service name changes or deprecations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regularly update both `boto3` and `mypy-boto3-sesv2` to their latest compatible versions. The `mypy-boto3` packages are typically built against specific `botocore` versions.","message":"Mismatching `boto3` runtime versions and `mypy-boto3-*` stub versions can lead to incorrect type checking or runtime errors. For optimal accuracy, keep your `boto3` and `mypy-boto3-sesv2` versions as aligned as possible.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}