{"id":3650,"library":"mypy-boto3-notifications","title":"mypy-boto3-notifications Type Annotations","description":"Provides static type annotations for the `boto3` AWS User Notifications service client, enhancing code reliability through static type checking with tools like MyPy. It is version 1.42.3, generated by `mypy-boto3-builder`, and receives frequent updates in sync with new `boto3` releases and builder improvements.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","mypy","typing","stubs","aws","notifications","type-hints"],"install":[{"cmd":"pip install mypy-boto3-notifications boto3","lang":"bash","label":"Install stubs and boto3"}],"dependencies":[{"reason":"Provides the actual AWS SDK runtime for which these stubs are generated. This package only provides type hints.","package":"boto3","optional":false}],"imports":[{"note":"Client types are nested under the `.client` submodule, not directly in the package root.","wrong":"from mypy_boto3_notifications import NotificationsClient","symbol":"NotificationsClient","correct":"from mypy_boto3_notifications.client import NotificationsClient"},{"note":"Type definitions for request/response bodies are located in the `.type_defs` submodule, separate from client interfaces.","wrong":"from mypy_boto3_notifications.client import PublishRequestRequestTypeDef","symbol":"PublishRequestRequestTypeDef","correct":"from mypy_boto3_notifications.type_defs import PublishRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_notifications.client import NotificationsClient\nfrom mypy_boto3_notifications.type_defs import PublishRequestRequestTypeDef\n\n# Ensure boto3 is installed: pip install boto3\n\ndef publish_notification(topic_arn: str, message: str) -> dict:\n    # Type-hint the boto3 client for AWS User Notifications\n    client: NotificationsClient = boto3.client(\"notifications\")\n\n    request_params: PublishRequestRequestTypeDef = {\n        \"Target\": {\"TargetArn\": topic_arn}, # Example target\n        \"Payload\": {\"Subject\": \"Alert\", \"Body\": message}\n    }\n\n    try:\n        response = client.publish(request_params)\n        print(f\"Notification published: {response.get('NotificationId')}\")\n        return response\n    except Exception as e:\n        print(f\"Error publishing notification: {e}\")\n        raise\n\n# Example usage (replace with actual ARN and message)\n# if __name__ == '__main__':\n#     # NOTE: This example requires valid AWS credentials and a configured Notifications target\n#     # This service is for AWS User Notifications, which integrates with targets like AWS Chatbot or SNS.\n#     # For actual SNS topics, use boto3.client(\"sns\").\n#     sample_topic_arn = \"arn:aws:sns:REGION:ACCOUNT_ID:TOPIC_NAME\" # This is just an example placeholder\n#     sample_message = \"This is a test notification from mypy-boto3-notifications.\"\n#     # publish_notification(sample_topic_arn, sample_message)","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-notifications` to type-hint a `boto3` client for the AWS User Notifications service. It shows importing the client type and a request `TypeDef`, then using them to ensure type correctness when interacting with the service. This allows MyPy to catch potential errors during development."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 support was removed from `mypy-boto3-builder` (which generates these stubs) in version 8.12.0. Users on Python 3.8 or older will need to upgrade their Python version to >=3.9 or use an older stub version.","severity":"breaking","affected_versions":"mypy-boto3-builder>=8.12.0, mypy-boto3-notifications corresponds to this"},{"fix":"Update `TypeDef` import names in your code to match the new conventions. Consult the specific service's `type_defs.pyi` for the correct names.","message":"Type definition (TypeDef) naming conventions changed in `mypy-boto3-builder` 8.9.0. This includes shorter names for packed method arguments (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving the `Extra` postfix. Code explicitly importing and using these `TypeDefs` may break.","severity":"breaking","affected_versions":"mypy-boto3-builder>=8.9.0, mypy-boto3-notifications corresponds to this"},{"fix":"Ensure both `boto3` (runtime) and `mypy` (dev) are installed alongside `mypy-boto3-notifications`.","message":"These packages (`mypy-boto3-notifications`) provide only type annotations. You must install `boto3` separately for the actual AWS SDK functionality at runtime. For type checking, `mypy` is also required as a development dependency.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your type checker (e.g., MyPy) is up-to-date and correctly configured to find PEP 561-style stub packages. Most common setups should work without manual intervention.","message":"The `mypy-boto3` ecosystem migrated to PEP 561-compliant packages in `mypy-boto3-builder` 8.12.0. While this generally improves compatibility, some tools or custom configurations that relied on older stub discovery mechanisms might require adjustments.","severity":"gotcha","affected_versions":"mypy-boto3-builder>=8.12.0, mypy-boto3-notifications corresponds to this"},{"fix":"Refer to official AWS `boto3` documentation for service names and changes. If a service is renamed, update your `boto3.client()` calls and corresponding `mypy-boto3-*` stub imports.","message":"Occasionally, specific AWS services may be renamed or deprecated within the `boto3` ecosystem (e.g., `sms-voice` was replaced by `pinpoint-sms-voice`). While this specific stub is for `notifications`, keep an eye on upstream `boto3` changes, as they might eventually affect the service name or availability.","severity":"gotcha","affected_versions":"All versions, depends on upstream AWS/boto3 changes"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}