mypy-boto3-frauddetector type stubs
mypy-boto3-frauddetector provides comprehensive type annotations for the `boto3` AWS FraudDetector service. Generated by `mypy-boto3-builder`, it offers static type checking for clients, resources, paginators, and waiters, significantly improving developer experience with tools like Mypy, Pyright, VSCode, and PyCharm. The library is actively maintained, with frequent updates aligning with `boto3` and `botocore` releases.
Warnings
- breaking `mypy-boto3-builder` 8.12.0 and later versions removed support for Python 3.8 across all generated packages. This package (1.42.3) requires Python 3.9 or newer.
- breaking Starting with `mypy-boto3-builder` 8.9.0, TypedDict names for method arguments may have changed (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Additionally, conflicting `Extra` postfixes were moved (`CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).
- gotcha When using `if TYPE_CHECKING:` to prevent runtime stub imports, Pylint might report 'undefined variable' errors for the type-hinted objects.
- gotcha PyCharm has known performance issues with `Literal` overloads (issue PY-40997) when using full `mypy-boto3-*` packages.
- gotcha While `boto3-stubs` often auto-discovers types for `session.client()` or `boto3.client()`, explicit type annotations for the client object (e.g., `client: FraudDetectorClient = ...`) are highly recommended for optimal IDE auto-completion and strict type checking, especially with `boto3-stubs-lite` variants.
Install
-
pip install boto3 mypy-boto3-frauddetector
Imports
- FraudDetectorClient
from mypy_boto3_frauddetector import FraudDetectorClient
- AsyncJobStatusType
from mypy_boto3_frauddetector.literals import AsyncJobStatusType
- ATIMetricDataPointTypeDef
from mypy_boto3_frauddetector.type_defs import ATIMetricDataPointTypeDef
Quickstart
import os
from typing import TYPE_CHECKING
from boto3.session import Session
# Only import type stubs during type checking
if TYPE_CHECKING:
from mypy_boto3_frauddetector import FraudDetectorClient
from mypy_boto3_frauddetector.type_defs import GetEventTypesResultTypeDef
# Instantiate a boto3 session (credentials are handled by boto3's default chain)
session = Session(
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),
region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')
)
# Get the FraudDetector client with type annotations
client: 'FraudDetectorClient' = session.client("frauddetector")
try:
# Example API call with type-hinted response
response: 'GetEventTypesResultTypeDef' = client.get_event_types()
print("Successfully retrieved FraudDetector event types.")
for event_type in response.get('EventTypes', []):
print(f" - Event Type: {event_type.get('Name')}")
except Exception as e:
print(f"Error retrieving FraudDetector event types: {e}")