Install & Compatibility
Where this runs
tested against v3.9.0 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.6MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.1s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SNSClient
✓ from types_aiobotocore_sns import SNSClient
✗ from types_aiobotocore_sns.client import SNSClient
This quickstart demonstrates how to use `types-aiobotocore-sns` with `aiobotocore` to publish a message to an SNS topic. It includes explicit type hinting for the SNS client, allowing type checkers to validate client calls and provide comprehensive autocomplete. The `TYPE_CHECKING` guard is used to ensure `types-aiobotocore-sns` is only a development dependency.
import asyncio
from typing import TYPE_CHECKING
from aiobotocore.session import get_session
import os
if TYPE_CHECKING:
from types_aiobotocore_sns.client import SNSClient
async def publish_message():
session = get_session()
# Ensure AWS credentials/config are available via environment variables or config files
# e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
async with session.create_client("sns") as client:
client: "SNSClient" # Explicit type annotation for IDEs/MyPy
topic_arn = os.environ.get('AWS_SNS_TOPIC_ARN', 'arn:aws:sns:REGION:ACCOUNT_ID:MyTopic')
message = "Hello from types-aiobotocore-sns!"
try:
response = await client.publish(TopicArn=topic_arn, Message=message)
print(f"Message published: {response['MessageId']}")
except client.exceptions.TopicNotFoundException:
print(f"Error: Topic {topic_arn} not found.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
# You would typically set AWS_SNS_TOPIC_ARN, AWS_REGION, etc., as environment variables.
# For this example, ensure they are set or default values are valid.
asyncio.run(publish_message())
Debug
Known issues
breakingSupport for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0 and later, which is used to generate `types-aiobotocore-sns` 3.4.0 and subsequent versions. Projects requiring Python 3.8 must use an older version of `types-aiobotocore-sns`.fixUpgrade your Python environment to 3.9 or higher. If Python 3.8 is required, pin `types-aiobotocore-sns` to a version generated by `mypy-boto3-builder <8.12.0` (e.g., `types-aiobotocore-sns<3.4.0`).
affects: >=3.4.0
breakingIn `mypy-boto3-builder` 8.9.0, some `TypeDef` names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). If your code explicitly imported these renamed `TypeDefs`, it will break.fixUpdate your import statements and references to the new, shorter `TypeDef` names. Consult the `types-aiobotocore-sns` documentation for the correct `TypeDef` names.
affects: >=3.2.0 (corresponding to builder 8.9.0)
deprecatedThe `sms-voice` service was deprecated and removed from `mypy-boto3-builder` (version 8.11.0 onwards). Users should switch to `pinpoint-sms-voice` instead.fixMigrate any usage of the `sms-voice` service to `pinpoint-sms-voice` and use the corresponding `types-aiobotocore-pinpoint-sms-voice` package.
affects: >=3.3.0 (corresponding to builder 8.11.0)
gotchaWhen using PyCharm, performance issues may occur due to how it handles `Literal` overloads. This can lead to slow performance and high CPU usage.fixIt is recommended to use `types-aiobotocore-lite` instead of the full package, or disable PyCharm's internal type checker and use `mypy` or `pyright` externally.
affects: All versions
gotchaFor production deployments, `types-aiobotocore-sns` should typically be a development-only dependency. To avoid runtime dependencies, guard type imports with `typing.TYPE_CHECKING`.fixWrap all `types_aiobotocore_sns` imports within `if TYPE_CHECKING:` blocks. For non-`TYPE_CHECKING` contexts, you may need to define placeholder `object` assignments for client types if explicitly used in function signatures.
affects: All versions
Upgrade
Version history
3.9.0latest on PyPI · released Aug 2, 2026
Audit
Dependencies
aiobotocorerequiredProvides the underlying asynchronous AWS client for which types are generated.
mypyoptionalPrimary static type checker that benefits from these annotations.