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.4s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ShieldClient
✓ from mypy_boto3_shield import ShieldClient
✗ from mypy_boto3_shield import ShieldClient
This quickstart demonstrates how to obtain a type-hinted `ShieldClient` and use its methods, benefiting from autocompletion and static type checking. It also shows an example of using a generated `TypedDict` for clearer data structure definitions. The `TYPE_CHECKING` block ensures type imports are only active during type-checking.
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_shield import ShieldClient
from mypy_boto3_shield.type_defs import ListAttacksResponseTypeDef
# Instantiate a Shield client with type hints
client: "ShieldClient" = boto3.client("shield")
# Example of using a client method with type checking
try:
response: "ListAttacksResponseTypeDef" = client.list_attacks()
print(f"Found {len(response.get('Attacks', []))} Shield attacks.")
except Exception as e:
print(f"Error listing attacks: {e}")
# Example of a TypedDict for input (if applicable, or output)
def process_response_action(action: "ResponseActionOutputTypeDef") -> None:
if 'Block' in action:
print(f"Action is a block: {action['Block']}")
elif 'Count' in action:
print(f"Action is a count: {action['Count']}")
# For demonstration, typically this comes from an API call
example_action: "ResponseActionOutputTypeDef" = {"Block": {}}
process_response_action(example_action)
Debug
Known issues
breakingAs of mypy-boto3-builder version 8.12.0, support for Python 3.8 has been removed across all generated `mypy-boto3` packages, including `mypy-boto3-shield`. Users on Python 3.8 will need to upgrade to Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or higher.
affects: mypy-boto3-builder >=8.12.0
breakingmypy-boto3-builder version 8.9.0 introduced breaking changes to `TypeDef` naming conventions, such as shortening `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef` and adjusting postfixes for conflicting names. This may require updating type annotation references in your codebase if you're upgrading from older versions.fixReview and update `TypeDef` names in your type annotations according to the new conventions.
affects: mypy-boto3-builder >=8.9.0
deprecatedThe original `mypy-boto3` package is considered legacy. It is recommended to use `boto3-stubs` (the umbrella package) or install individual service stubs like `mypy-boto3-shield` directly for better compatibility and maintenance.fixPrefer `boto3-stubs[service_name]` or direct `mypy-boto3-service_name` installations over the legacy `mypy-boto3` package.
affects: All versions
gotchaPyCharm may experience slow performance with `Literal` overloads from `mypy-boto3` stubs (issue PY-40997). If this occurs, it's recommended to use `boto3-stubs-lite` (if available for the service) or to disable PyCharm's internal type checker and rely on external tools like `mypy` or `pyright`.fixConsider `pip uninstall boto3-stubs && pip install boto3-stubs-lite` or configure PyCharm to use an external type checker.
affects: All versions
gotchaWhile `mypy-boto3` generally provides auto-discovery of types for `boto3.client` calls, explicit type annotations for the client object (e.g., `client: ShieldClient = boto3.client('shield')`) are often necessary for the best autocompletion and type-checking experience in IDEs like VSCode and PyCharm, especially for methods like `get_paginator` or `get_waiter`.fixAdd explicit type annotations when instantiating clients, paginators, and waiters for optimal IDE support.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredRuntime dependency for the AWS SDK for Python (Boto3).
mypyrequiredStatic type checker, for which these annotations are primarily intended.
pythonrequiredRequires Python 3.9 or higher.