{"id":2131,"library":"mypy-boto3-ses","title":"mypy-boto3-ses type annotations","description":"mypy-boto3-ses provides comprehensive type annotations for the AWS Boto3 SES (Simple Email Service) client, enhancing developer experience with static type checking, auto-completion, and early error detection. It is a generated package from the `mypy-boto3-builder` project, closely tracking `boto3` releases to ensure up-to-date type definitions. The project maintains an active release cadence, often synchronizing with new `boto3` versions and Python updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["typing","type hints","boto3","aws","ses","mypy"],"install":[{"cmd":"pip install mypy-boto3-ses boto3","lang":"bash","label":"Install with boto3"}],"dependencies":[{"reason":"This package provides type annotations for the `boto3` library; `boto3` itself is required at runtime.","package":"boto3","optional":false}],"imports":[{"note":"Type annotation for the SES client object from boto3.","symbol":"SESClient","correct":"from mypy_boto3_ses.client import SESClient"},{"note":"Type definition for input parameters of the `send_email` method.","symbol":"SendEmailRequestRequestTypeDef","correct":"from mypy_boto3_ses.type_defs import SendEmailRequestRequestTypeDef"},{"note":"Type definition for the response object of the `send_email` method.","symbol":"SendEmailResponseTypeDef","correct":"from mypy_boto3_ses.type_defs import SendEmailResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_ses.client import SESClient\n    from mypy_boto3_ses.type_defs import SendEmailRequestRequestTypeDef, SendEmailResponseTypeDef\n\ndef send_ses_email(\n    recipient_email: str, \n    sender_email: str, \n    subject: str, \n    body: str\n) -> SendEmailResponseTypeDef:\n    # In a real application, you might get region_name or credentials differently\n    client: SESClient = boto3.client(\"ses\", region_name=\"us-east-1\")\n\n    email_params: SendEmailRequestRequestTypeDef = {\n        \"Source\": sender_email,\n        \"Destination\": {\"ToAddresses\": [recipient_email]},\n        \"Message\": {\n            \"Subject\": {\"Data\": subject},\n            \"Body\": {\"Text\": {\"Data\": body}},\n        },\n    }\n    response: SendEmailResponseTypeDef = client.send_email(**email_params)\n    print(f\"Email sent! Message ID: {response['MessageId']}\")\n    return response\n\n# Example usage (will not actually send email without AWS credentials and setup)\n# You would replace these with actual values\n# if __name__ == \"__main__\":\n#     from os import environ\n#     send_ses_email(\n#         recipient_email=environ.get('SES_RECIPIENT_EMAIL', 'test@example.com'),\n#         sender_email=environ.get('SES_SENDER_EMAIL', 'sender@example.com'),\n#         subject='Test Subject',\n#         body='This is a test email body.'\n#     )","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-ses` to type-hint a Boto3 SES client and its associated request/response type definitions for the `send_email` operation. The `TYPE_CHECKING` block ensures that the `mypy-boto3-ses` dependency is only active during type checking, avoiding runtime overhead."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Starting with `mypy-boto3-builder` version 8.12.0, Python 3.8 is no longer supported for any generated packages, including `mypy-boto3-ses`. Ensure your project uses Python 3.9 or higher.","severity":"breaking","affected_versions":">=8.12.0 (builder)"},{"fix":"Update your type annotation imports and references to match the new TypeDef naming conventions. Consult the `mypy-boto3-builder` documentation or your type checker's errors for the correct names.","message":"In `mypy-boto3-builder` version 8.9.0, there were breaking changes to TypeDef naming conventions. Packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). If you relied on specific, longer TypeDef names, they may have changed.","severity":"breaking","affected_versions":">=8.9.0 (builder)"},{"fix":"Always install `boto3` alongside `mypy-boto3-ses` using `pip install boto3 mypy-boto3-ses`.","message":"While `mypy-boto3-ses` provides type annotations, it is crucial to also install the `boto3` library itself. `mypy-boto3-ses` only adds static typing capabilities and does not include the runtime `boto3` functionality.","severity":"gotcha","affected_versions":"All"},{"fix":"For full compatibility and to avoid runtime dependencies, use the `if TYPE_CHECKING:` block. Ensure your type checker (mypy, pyright) and IDE are updated to support PEP 561 correctly.","message":"The `mypy-boto3` ecosystem moved to PEP 561 compliant packages in version 8.12.0 of the builder. This generally means type checkers should discover stubs automatically. However, some IDEs or linters (like older Pylint versions) might require explicit type annotations (as shown in the Quickstart) or `TYPE_CHECKING` guards to avoid 'undefined variable' complaints.","severity":"gotcha","affected_versions":">=8.12.0 (builder)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}