Registry / type-stubs / mypy-boto3-guardduty

mypy-boto3-guardduty

JSON →
library1.43.54pypypi✓ verified 23d ago

Type annotations for the `boto3` GuardDuty service, generated with `mypy-boto3-builder`. It provides comprehensive type hints for clients, paginators, literals, and type definitions, ensuring compatibility with static type checkers like mypy and enhancing IDE experiences in VSCode, PyCharm, and others. The library is actively maintained and frequently updated to synchronize with `boto3` and `mypy-boto3-builder` releases, currently at version 1.42.84.

pip install mypy-boto3-guardduty boto3
INSTALL
IMPORT
SIG · MYPY-BOTO3-GUARDDU
M
mypy-boto3-guardduty
type-stubspythonv1.43.54
Install
3.9s avg
Import
721ms
Disk
51MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.54 · 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.752s · 52.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 0.690s · 53MB
51MB installed
● package 51MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GuardDutyClient
from mypy_boto3_guardduty.client import GuardDutyClient
AcceptAdministratorInvitationRequestTypeDef
from mypy_boto3_guardduty.type_defs import AcceptAdministratorInvitationRequestTypeDef
Example of importing a generated TypedDict for request/response bodies.
AdminStatusType
from mypy_boto3_guardduty.literals import AdminStatusType
Example of importing a generated Literal for enum-like string values.

This example demonstrates how to initialize a `GuardDutyClient` with type annotations and list existing detectors. The `TYPE_CHECKING` block ensures that type imports are only active during static analysis, avoiding runtime dependencies. Explicit client annotation is shown for improved IDE autocomplete and type validation.

import boto3 from typing import TYPE_CHECKING import os if TYPE_CHECKING: from mypy_boto3_guardduty.client import GuardDutyClient from mypy_boto3_guardduty.type_defs import ListDetectorsResponseTypeDef def get_guardduty_detectors() -> None: # Explicit type annotation for the client for better IDE support client: GuardDutyClient = boto3.client( "guardduty", region_name=os.environ.get('AWS_REGION', 'us-east-1'), 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') ) print("Listing GuardDuty detectors...") try: response: ListDetectorsResponseTypeDef = client.list_detectors() detector_ids = response.get('DetectorIds', []) if detector_ids: print(f"Found {len(detector_ids)} detectors: {', '.join(detector_ids)}") else: print("No GuardDuty detectors found.") except client.exceptions.ClientError as e: print(f"Error listing detectors: {e}") if __name__ == "__main__": get_guardduty_detectors()
Debug
Known issues
breakingDirect support for Python 3.8 was removed starting with `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-guardduty` 1.42.84). The library now officially requires Python >=3.9.
fix
Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin `mypy-boto3-builder` to a version prior to 8.12.0 and corresponding service stubs, but be aware of potential issues and lack of updates.
affects: mypy-boto3-builder >=8.12.0
breakingPrior to `mypy-boto3-builder` 8.9.0, some generated `TypeDef` names were longer (e.g., `CreateDistributionRequestRequestTypeDef`). Version 8.9.0 introduced changes to shorten these names where possible, which can break existing code relying on the old `TypeDef` names.
fix
Review your type-hinted code and update `TypeDef` import paths and names to match the new, shortened conventions. The full list of changes would be in the `mypy-boto3-builder` changelog.
affects: mypy-boto3-builder >=8.9.0
gotchaFor optimal IDE support (e.g., in VSCode) and accurate autocompletion for `boto3.client` and `session.client` calls, it is recommended to explicitly type-annotate the client object, as some IDEs may not fully support function overloads for dynamic clients.
fix
Declare the client with its specific type, for example: `client: GuardDutyClient = boto3.client('guardduty')`. This provides the best developer experience.
affects: All versions
gotchaWhen using `if TYPE_CHECKING:` blocks to conditionally import type stubs, linters like Pylint may report `undefined-variable` errors for the type-hinted objects in the runtime code path. This happens because Pylint doesn't always correctly parse the `TYPE_CHECKING` guard.
fix
To suppress Pylint errors in this scenario, assign `object` to the type-hinted variable in the `else` block of the `if TYPE_CHECKING:` statement. Example: `if TYPE_CHECKING: from mypy_boto3_guardduty.client import GuardDutyClient else: GuardDutyClient = object`.
affects: All versions
Upgrade
Version history
1.43.54latest on PyPI · released Jul 22, 2026
Audit
Dependencies
boto3requiredRuntime dependency for AWS SDK functionality. `mypy-boto3-guardduty` provides type stubs for this package.
typing-extensionsoptionalRequired for some type features on older Python versions (<3.9), automatically handled by `mypy-boto3-builder`'s dependency resolution.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
mypy-boto3-guardduty — pip install mypy-boto3-guardduty · libregistry