Registry /
type-stubs / mypy-boto3-cognito-sync
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.000s · 19.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.5s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CognitoSyncClient
✓ from mypy_boto3_cognito_sync import CognitoSyncClient
✗ from mypy_boto3_cognito_sync import CognitoSyncClient
This quickstart demonstrates how to use the `CognitoSyncClient` type annotation with a boto3 Cognito Sync client. The `TYPE_CHECKING` guard is a best practice to avoid importing the stubs at runtime, making them purely a development dependency. The example shows a typical `list_datasets` operation, which benefits from type hints on client methods and response structures.
from typing import TYPE_CHECKING
import boto3
if TYPE_CHECKING:
from mypy_boto3_cognito_sync import CognitoSyncClient
from mypy_boto3_cognito_sync.type_defs import DatasetTypeDef
# Initialize a boto3 session and client
session = boto3.session.Session()
client: "CognitoSyncClient" = session.client("cognito-sync")
# Example: List Identity Pools (Cognito Sync operations often tie to Identity Pools)
# Note: Cognito Sync operations are typically tied to specific identities or datasets.
# This example is illustrative for client type-checking.
try:
# Placeholder for actual Cognito Sync operation, as ListIdentityPools is CognitoIdentity
# A more realistic CognitoSync operation would be something like list_records
# For this example, we'll simulate a call that uses the client.
# In a real scenario, you'd provide IdentityPoolId, IdentityId, DatasetName, etc.
# For demonstration, we'll use a dummy call that the client can execute.
# (Note: CognitoSync doesn't have a simple 'list all' like many services)
# A common operation is to list datasets for an identity.
identity_pool_id = os.environ.get('COGNITO_IDENTITY_POOL_ID', 'us-east-1:xxxx-xxxx-xxxx') # Dummy ID
identity_id = os.environ.get('COGNITO_IDENTITY_ID', 'us-east-1:xxxx-xxxx-xxxx') # Dummy ID
response = client.list_datasets(
IdentityPoolId=identity_pool_id,
IdentityId=identity_id
)
print("Datasets:")
for dataset in response.get("Datasets", []):
# dataset is type-checked as DatasetTypeDef
dataset_typed: "DatasetTypeDef" = dataset
print(f" Dataset Name: {dataset_typed['DatasetName']}, Num Records: {dataset_typed['NumRecords']}")
except client.exceptions.ResourceNotFoundException:
print(f"Identity Pool or Identity not found for ID: {identity_pool_id}, {identity_id}")
except Exception as e:
print(f"An error occurred: {e}")
Debug
Known issues
breakingPython 3.8 support was removed for all `mypy-boto3` packages (including this one) in `mypy-boto3-builder` version 8.12.0. Projects must use Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or higher.
affects: mypy-boto3-builder >=8.12.0
breakingAll `mypy-boto3` packages migrated to PEP 561, changing how type checkers discover packages. Ensure your `mypy` configuration (if any) is compatible with standard PEP 561 stub discovery.fixNo direct code change required, but verify your `mypy` setup recognizes the stubs correctly. Most modern tooling handles PEP 561 automatically.
affects: mypy-boto3-builder >=8.12.0
breakingTypedDict argument names for packed methods were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were reordered in `mypy-boto3-builder 8.9.0`. This can break explicit `TypeDef` imports or usage if not updated.fixReview and update `TypeDef` imports and usage patterns in your code to match the new, shorter names where applicable.
affects: mypy-boto3-builder >=8.9.0
gotchaThis package provides only type stubs for `boto3-stubs`. You must install the actual `boto3` library separately for your application to run. `mypy-boto3-cognito-sync` is a development dependency, not a runtime dependency.fixEnsure `pip install boto3` is part of your project's runtime dependencies.
affects: All versions
gotchaWhen installing `boto3-stubs` with service-specific extras (e.g., `boto3-stubs[cognito-sync]`), the version of the individual `mypy-boto3-*` sub-package might not be strictly locked to the specified `boto3-stubs` version. This can lead to unexpected type-checking errors if the installed sub-package is significantly newer than anticipated.fixTo strictly pin the version, install the specific `mypy-boto3-cognito-sync` package directly with `pip install mypy-boto3-cognito-sync==X.Y.Z` in addition to or instead of the `boto3-stubs` extra.
affects: All versions
gotchaUsing `Literal` type overloads can cause slow performance and high CPU usage in PyCharm (issue PY-40997). For PyCharm users, `boto3-stubs-lite` is recommended as an alternative for better IDE responsiveness.fixConsider installing `boto3-stubs-lite[cognito-sync]` instead, or disable PyCharm's internal type checker and use an external tool like `mypy` or `pyright`.
affects: All versions (specific to PyCharm)
gotchaWhen using `Pylint` with `TYPE_CHECKING` blocks for conditional stub imports, `Pylint` may complain about undefined variables. This requires setting the conditionally imported types to `object` in the non-`TYPE_CHECKING` branch.fixImplement conditional type assignment, e.g., `if TYPE_CHECKING: from mypy_boto3_cognito_sync import CognitoSyncClient else: CognitoSyncClient = object`.
affects: All versions (specific to Pylint)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for boto3; boto3 itself must be installed for runtime functionality.
pythonrequiredRequires Python 3.9 or higher.