Registry / type-stubs / mypy-boto3-sns

mypy-boto3-sns

JSON →
library1.43.23pypypi✓ verified 23d ago

mypy-boto3-sns provides type annotations for the AWS Boto3 SNS (Simple Notification Service) client and resources. It enhances development experience with type checking tools like mypy, pyright, and IDEs (VSCode, PyCharm) by offering static analysis for Boto3 code. This package, currently at version 1.42.3, is generated by `mypy-boto3-builder` (version 8.12.0) and typically releases in sync with `boto3` updates.

pip install mypy-boto3-sns boto3 mypy
INSTALL
IMPORT
SIG · MYPY-BOTO3-SNS
M
mypy-boto3-sns
type-stubspythonv1.43.23
Install
6.1s avg
Import
786ms
Disk
114MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.23 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.806s · 116.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.1s · import 0.766s · 114MB
114MB installed
● package 114MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SNSClient
from mypy_boto3_sns.client import SNSClient
For explicit type annotations of the SNS client.
SNSServiceResource
from mypy_boto3_sns.service_resource import SNSServiceResource
For explicit type annotations of the SNS service resource.
AddPermissionInputTopicAddPermissionTypeDef
from mypy_boto3_sns.type_defs import AddPermissionInputTopicAddPermissionTypeDef
For explicit type annotations of specific TypeDefs, often used for method arguments.

This example demonstrates how to obtain an SNS client with and without explicit type annotations using `mypy-boto3-sns`. Type annotations are primarily for static analysis tools during development, not for runtime execution. The `TYPE_CHECKING` block shows how `mypy` would verify types.

import boto3 from typing import TYPE_CHECKING from mypy_boto3_sns.client import SNSClient # Boto3 client without explicit type annotation (type checker will infer) def get_sns_client_inferred(): return boto3.client("sns") # Boto3 client with explicit type annotation (recommended for type checking) def get_sns_client_typed() -> SNSClient: return boto3.client("sns") if TYPE_CHECKING: # Example usage with type checking sns_client: SNSClient = get_sns_client_typed() response = sns_client.publish(TopicArn="arn:aws:sns:REGION:ACCOUNT:TOPIC", Message="Hello, SNS!") print(f"Message ID: {response['MessageId']}") # Normal runtime usage (type hints are ignored by the interpreter) sns_client_runtime = get_sns_client_inferred() # You would typically have actual topic/message data here, # but for a quickstart, we keep it simple. # Replace with a valid TopicArn for actual execution. # response_runtime = sns_client_runtime.publish(TopicArn="arn:aws:sns:REGION:ACCOUNT:TOPIC", Message="Hello from runtime!") # print(f"Runtime Message ID: {response_runtime['MessageId']}")
Debug
Known issues
breakingRemoved support for Python 3.8. The `mypy-boto3-builder` 8.12.0, which generated `mypy-boto3-sns` 1.42.3, no longer supports Python 3.8. Users on Python 3.8 must either upgrade their Python version or use an older version of `mypy-boto3-sns`.
fix
Upgrade to Python 3.9 or higher. If unable to upgrade Python, pin `mypy-boto3-sns` to an older compatible version.
affects: >=1.42.3 (builder >=8.12.0)
breakingBreaking changes to `TypeDef` naming conventions. In `mypy-boto3-builder` 8.9.0 (and potentially affecting later versions), `TypeDef` names for packed method arguments were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). Additionally, conflicting `Extra` postfixes were moved to the end of the name (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`). While not specific to SNS in the release notes, this applies to `[services]` generated by the builder and may affect users relying on specific `TypeDef` names.
fix
Review your code for direct imports or usage of `TypeDef` names and update them according to the new naming conventions. Consult the specific service's documentation for exact new names.
affects: >=0.9.0 (builder >=8.9.0)
gotchaThe library only provides type hints; it does not add runtime functionality to `boto3`. `mypy-boto3-sns` is a stub package that helps static type checkers (like mypy) understand `boto3`'s API. It is not a replacement for `boto3` and has no runtime impact on your application.
fix
Ensure `boto3` is installed alongside `mypy-boto3-sns`. Do not expect `mypy-boto3-sns` to provide actual AWS SDK functionality.
affects: All versions
gotcha`pylint` may complain about undefined variables when using `typing.TYPE_CHECKING` for conditional imports. This is a known issue.
fix
Set all types to `object` in the `else` block for `if TYPE_CHECKING:` statements to provide a fallback for `pylint`. Example: `if TYPE_CHECKING: from mypy_boto3_sns.client import SNSClient else: SNSClient = object`
affects: All versions
gotchaThere are two main ways to install boto3 stubs: `mypy-boto3-sns` (standalone) or `boto3-stubs[sns]` (part of the `boto3-stubs` meta-package). Confusing these or mixing installations can lead to unexpected type-checking behavior.
fix
Choose one installation strategy and stick to it. For individual service stubs, `pip install mypy-boto3-sns` is appropriate. For a more integrated approach, `pip install 'boto3-stubs[sns]'` is another option.
affects: All versions
Upgrade
Version history
1.43.23latest on PyPI · released Jun 4, 2026
Audit
Dependencies
boto3requiredRuntime dependency for the AWS SDK being type-hinted.
mypyrequiredStatic type checker, the primary consumer of these stubs.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
mypy-boto3-sns — pip install mypy-boto3-sns · libregistry