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.95 runs
installs and imports cleanly · install 0.0s · import 0.596s · 52MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.9s · import 0.566s · 53MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MTurkClient
✓ from mypy_boto3_mturk.client import MTurkClient
✗ from mypy_boto3_mturk import MTurkClient
Client types are typically located in the `.client` submodule for `mypy-boto3` packages.
MTurkServiceName
✓ from mypy_boto3_mturk.literals import MTurkServiceName
Literals for service names are useful for explicit type hinting in `boto3.client` calls.
This quickstart demonstrates how to obtain a type-hinted `MTurkClient` using `boto3` and the `mypy-boto3-mturk` stubs. It uses a `TYPE_CHECKING` guard to ensure the type import is only active during static analysis, preventing runtime import errors if `mypy-boto3-mturk` is not installed in the production environment.
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_mturk.client import MTurkClient
def get_mturk_client() -> MTurkClient:
"""Returns a type-hinted MTurk client."""
# boto3.client returns botocore.client.BaseClient at runtime,
# but mypy will correctly infer MTurkClient type from the annotation.
client: MTurkClient = boto3.client('mturk')
return client
# Example usage:
mturk_client = get_mturk_client()
# Now mturk_client has type hints for MTurk service methods
# For example, mturk_client.list_hits() will have correct type signatures.
# This is a runnable example, but it requires valid AWS credentials
# and an active MTurk environment for actual API calls.
# print(mturk_client.list_hits()) # Uncomment to run actual API call
Debug
Known issues
breakingSupport for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Consequently, `mypy-boto3-mturk` versions generated with this builder (including 1.42.3) and newer require Python 3.9 or higher.fixUpgrade your Python environment to 3.9 or newer.
affects: mypy-boto3-builder >=8.12.0, mypy-boto3-mturk >=1.42.3
breakingIn `mypy-boto3-builder` 8.9.0, there were breaking changes to TypeDef naming conventions, particularly for packed method arguments and conflicting names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).fixReview your code for TypeDef imports and update names according to the new conventions. Consult the `mypy-boto3-builder` release notes for specific changes.
affects: mypy-boto3-builder >=8.9.0, mypy-boto3-mturk built with these versions
gotcha`mypy-boto3-mturk` provides *only type annotations*. It does not include the `boto3` library itself. You must install `boto3` separately to use the AWS SDK at runtime.fixEnsure `pip install boto3` is executed in your environment alongside `mypy-boto3-mturk`.
affects: All versions
gotchaWhen using standalone `mypy-boto3-*` packages or `boto3-stubs-lite`, explicit type annotations for `boto3.client` and `boto3.resource` calls are often required for optimal type inference.fixAlways add explicit type hints like `client: MTurkClient = boto3.client('mturk')`. affects: All versions
gotchaPyCharm users might experience slow performance with `Literal` overloads. It is recommended to use the `boto3-stubs-lite` packages or generate custom stubs locally with `mypy-boto3-builder` to mitigate this issue.fixConsider `pip install boto3-stubs-lite[mturk]` or use custom generated stubs for improved IDE performance.
affects: All versions (specifically with PyCharm IDE)
gotchaFor `pylint` compatibility, especially when `mypy-boto3-mturk` is not a runtime dependency, use a `TYPE_CHECKING` guard around type imports and assign `object` to types in the `else` block to avoid `undefined variable` errors from `pylint`.fixImplement `if TYPE_CHECKING: from mypy_boto3_mturk.client import MTurkClient else: MTurkClient = object`.
affects: All versions (when using pylint without runtime stub dependency)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
pythonrequiredRequired Python version.
boto3requiredProvides the AWS SDK for Python; this library only provides type annotations.