mypy-boto3-macie2 Type Annotations for AWS Macie2
mypy-boto3-macie2 provides type annotations for the AWS Macie2 service client in boto3. It helps improve code quality and catch type-related errors during development by offering static type checking for Macie2 service calls. The current version is 1.42.3, and it follows a release cadence tied to the upstream boto3 library and its own builder updates.
Warnings
- breaking Support for Python 3.8 was removed in version 8.12.0 of the mypy-boto3-builder. Users on Python 3.8 will need to upgrade to Python 3.9 or newer to use current versions of mypy-boto3-macie2.
- breaking All packages migrated to PEP 561 compliant distribution. This change (introduced in builder version 8.12.0) might affect how type checkers discover the packages if you had specific configurations relying on older distribution methods.
- breaking Some TypeDef naming conventions were changed (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`). This impacts direct references to these generated type definition classes in your code.
- gotcha This library only provides type stubs; `boto3` must be installed separately as a runtime dependency. Without `boto3` installed, your application will fail at runtime despite passing type checks.
- gotcha For type checking a specific AWS service, you must install the corresponding `mypy-boto3-*` package (e.g., `mypy-boto3-macie2`). Installing only `boto3-stubs` (the meta-package) or `boto3` will not provide specific service client type annotations.
Install
-
pip install mypy-boto3-macie2 boto3
Imports
- Macie2Client
from mypy_boto3_macie2 import Macie2Client
- ListFindingsRequestRequestTypeDef
from mypy_boto3_macie2.type_defs import ListFindingsRequestRequestTypeDef
- FindingStatusType
from mypy_boto3_macie2.literals import FindingStatusType
Quickstart
import boto3
from mypy_boto3_macie2 import Macie2Client
from mypy_boto3_macie2.type_defs import ListFindingsRequestRequestTypeDef
def analyze_macie_findings() -> None:
# mypy will now correctly type-check the client
client: Macie2Client = boto3.client("macie2")
# Example of a type-checked request parameter
request_params: ListFindingsRequestRequestTypeDef = {
"maxResults": 10
}
try:
response = client.list_findings(**request_params)
print(f"Found {len(response.get('findingIds', []))} Macie findings.")
except Exception as e:
print(f"Error listing Macie findings: {e}")
if __name__ == "__main__":
analyze_macie_findings()