{"id":27490,"library":"types-boto3-sns","title":"types-boto3-sns","description":"Type annotations for boto3 SNS 1.43.0 service generated with mypy-boto3-builder 8.12.0. Provides static type checking for AWS SNS API calls, compatible with mypy, pyright, and type-checkers. Current version: 1.43.0. Release cadence: follows boto3 SNS service updates.","status":"active","version":"1.43.0","language":"python","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","sns","type-stubs","mypy","ammazon-web-services","types"],"install":[{"cmd":"pip install boto3-stubs[sns]","lang":"bash","label":"Recommended install with boto3-stubs"},{"cmd":"pip install types-boto3-sns","lang":"bash","label":"Standalone install"}],"dependencies":[{"reason":"Runtime dependency for AWS SDK calls; types depend on service structure.","package":"boto3","optional":false},{"reason":"Provides essential types for boto3 itself; often required for type checking.","package":"boto3-stubs","optional":true},{"reason":"Required for Python <3.10 for TypedDict and other features.","package":"typing-extensions","optional":true}],"imports":[{"note":"boto3 itself doesn't export SNSClient type; must use mypy_boto3_sns.","wrong":"from boto3.sns import SNSClient","symbol":"SNSClient","correct":"from mypy_boto3_sns.client import SNSClient"},{"note":"Top-level types_boto3_sns module does not export SNSClient; use subpackage.","wrong":"from types_boto3_sns import SNSClient","symbol":"SNSClient","correct":"from mypy_boto3_sns.client import SNSClient"},{"note":"Use mypy_boto3_sns, not types_boto3_sns, for correct imports.","wrong":"from types_boto3_sns.type_defs import PublishResponseTypeDef","symbol":"PublishResponseTypeDef","correct":"from mypy_boto3_sns.type_defs import PublishResponseTypeDef"},{"note":"boto3.sns.type_defs does not exist; types are in mypy_boto3_sns.type_defs.","wrong":"from boto3.sns.type_defs import ListTopicsResultTypeDef","symbol":"ListTopicsResultTypeDef","correct":"from mypy_boto3_sns.type_defs import ListTopicsResultTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_sns.client import SNSClient\nfrom mypy_boto3_sns.type_defs import PublishResponseTypeDef\n\nclient: SNSClient = boto3.client(\"sns\", region_name=\"us-east-1\")\nresponse: PublishResponseTypeDef = client.publish(\n    PhoneNumber=\"+1234567890\",\n    Message=\"Hello from mypy!\"\n)\nprint(response[\"MessageId\"])","lang":"python","description":"Create an SNS client with type annotations and publish an SMS message."},"warnings":[{"fix":"Pin types-boto3-sns to a specific version in your requirements file.","message":"TypeDef names may change between versions due to auto-generation. For example, in version 8.9.0, TypeDefs for packed method arguments were renamed (e.g., CreateDistributionRequestRequestTypeDef -> CreateDistributionRequestTypeDef). Lock your types version to avoid CI breaks.","severity":"breaking","affected_versions":">=1.30.0,<2.0.0"},{"fix":"Use Python 3.9+ or pin to types-boto3-sns<1.43.0.","message":"Python 3.8 support was removed in mypy-boto3-builder 8.12.0. If you are on Python 3.8, upgrade to Python >=3.9 or stick to an older version of types-boto3-sns.","severity":"deprecated","affected_versions":">=1.43.0"},{"fix":"Use `import mypy_boto3_sns` or `from mypy_boto3_sns.client import SNSClient`.","message":"Importing from `types_boto3_sns` directly (with underscore) is a common mistake. The correct top-level package is `mypy_boto3_sns` (with underscore after mypy). `types_boto3_sns` is the PyPI distribution name, not the importable package.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with 'pip install boto3-stubs[sns]' or 'pip install types-boto3-sns', then import as 'import mypy_boto3_sns'.","cause":"Installing the wrong package; 'types-boto3-sns' is the PyPI name but the module is 'mypy_boto3_sns'.","error":"ModuleNotFoundError: No module named 'mypy_boto3_sns'"},{"fix":"From mypy_boto3_sns.client import SNSClient","cause":"Trying to import SNSClient from boto3 directly, which does not export type annotations.","error":"ImportError: cannot import name 'SNSClient' from 'boto3' (unknown location)"},{"fix":"Upgrade to Python 3.9+ or use 'from typing import List, Dict' and annotate as List[str], etc.","cause":"Using list/dict type hints without importing from typing or using PEP 585 style, e.g., list[str] on Python <3.9.","error":"TypeError: 'type' object is not subscriptable","affected_versions":"<3.9"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}