Registry /
type-stubs / mypy-boto3-connectcampaigns
Install & Compatibility
Where this runs
tested against v1.43.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.585s · 53.3MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 5.5s · import 0.540s · 54MB
52MB installed
● package 52MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ConnectCampaignServiceClient
✓ from mypy_boto3_connectcampaigns import ConnectCampaignServiceClient
Client type annotation for boto3.client('connectcampaigns')
ListCampaignsPaginator
✓ from mypy_boto3_connectcampaigns.paginator import ListCampaignsPaginator
Paginator type annotation for client.get_paginator('list_campaigns')
CampaignStateType
✓ from mypy_boto3_connectcampaigns.literals import CampaignStateType
Literal type for campaign states
CreateCampaignRequestTypeDef
✓ from mypy_boto3_connectcampaigns.type_defs import CreateCampaignRequestTypeDef
TypedDict for CreateCampaign API request parameters
This quickstart demonstrates how to use the `mypy-boto3-connectcampaigns` type annotations with a boto3 client. It shows explicit type hints for the client and a `TypeDef` for request parameters, which is particularly useful for complex AWS API calls. It includes a `TYPE_CHECKING` block to ensure the stub dependency is only active during static analysis, preventing runtime issues if the stub is not installed or to reduce production package size.
import boto3
import os
from typing import TYPE_CHECKING
# Conditional import for type checking only
if TYPE_CHECKING:
from mypy_boto3_connectcampaigns import ConnectCampaignServiceClient
from mypy_boto3_connectcampaigns.type_defs import CreateCampaignRequestTypeDef
def create_campaign_typed(
client: 'ConnectCampaignServiceClient',
instance_id: str,
campaign_name: str
) -> dict:
dialer_config: CreateCampaignRequestTypeDef['dialerConfig'] = {
'progressiveDialerConfig': {
'bandwidthAllocation': 1.0,
'dialingCapacity': 100.0
}
}
outbound_config: CreateCampaignRequestTypeDef['outboundCallConfig'] = {
'connectContactFlowId': os.environ.get('CONNECT_CONTACT_FLOW_ID', 'dummy-flow-id'),
'connectQueueId': os.environ.get('CONNECT_QUEUE_ID', 'dummy-queue-id'),
}
response = client.create_campaign(
name=campaign_name,
connectInstanceId=instance_id,
dialerConfig=dialer_config,
outboundCallConfig=outbound_config
)
print(f"Created campaign: {response.get('id')}")
return response
# Example usage (runtime without type checking dependency)
if __name__ == "__main__":
# In a real scenario, these would be actual AWS resource IDs
connect_instance_id = os.environ.get(
'CONNECT_INSTANCE_ID',
'arn:aws:connect:us-east-1:123456789012:instance/dummy-instance-id'
)
campaign_name = "MyTestCampaign"
# Boto3 client without explicit type hint for runtime
# Type checkers (like mypy) will infer ConnectCampaignServiceClient
connect_campaigns_client = boto3.client('connectcampaigns')
# Using the typed function
print("Attempting to create a campaign...")
try:
# This call would typically fail without valid AWS credentials and resource IDs
# For demonstration, we'll catch the expected client error
result = create_campaign_typed(
connect_campaigns_client, # type: ignore # Mypy might complain without explicit cast or if not in TYPE_CHECKING block
connect_instance_id,
campaign_name
)
print(f"Function returned (actual creation might fail without real AWS setup): {result}")
except Exception as e:
print(f"Caught expected error during campaign creation (requires valid AWS setup): {e}")
print("Please ensure CONNECT_INSTANCE_ID, CONNECT_CONTACT_FLOW_ID, CONNECT_QUEUE_ID env vars are set for a successful run.")
Debug
Known issues
breakingPython 3.8 support has been removed since `mypy-boto3-builder` version 8.12.0. Users must upgrade to Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or a later version. Ensure `python_requires='>=3.9'` is set in your project.
affects: >=8.12.0 (builder), all stubs generated by it.
breakingTypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Packed method argument TypeDefs use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting 'Extra' postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).fixUpdate your code to use the new TypeDef names as per the latest generated stubs. Refer to the documentation or your IDE's auto-completion.
affects: >=8.9.0 (builder), all stubs generated by it.
deprecatedThe `sms-voice` service was deprecated and removed from `mypy-boto3-builder` in version 8.11.0. Users of `sms-voice` stubs should migrate to `pinpoint-sms-voice`.fixIf your project uses `sms-voice`, switch to `pinpoint-sms-voice` for both runtime boto3 calls and type annotations.
affects: >=8.11.0 (builder), stubs related to `sms-voice`
gotchaWhile MyPy and PyCharm often infer types automatically, VSCode and some other IDEs might require explicit type annotations for `boto3.client`, `boto3.session.client`, `client.get_waiter`, and `client.get_paginator` calls for full auto-completion and type checking.fixAdd explicit type hints, e.g., `client: ConnectCampaignServiceClient = boto3.client('connectcampaigns')`. affects: All versions
gotchaFor conditional type checking to avoid runtime dependencies on stubs (e.g., in production builds) or to address `pylint` warnings about undefined variables, use `typing.TYPE_CHECKING` with fallback to `object`.fixWrap stub imports with `if TYPE_CHECKING:` and define runtime placeholders with `else: MyType = object`.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredRuntime dependency for the AWS SDK, which these stubs annotate.
mypyoptionalOptional, for static type checking; this library provides the types.