mypy-boto3-networkflowmonitor Type Stubs
mypy-boto3-networkflowmonitor provides precise type annotations for the `boto3` client and resources related to the AWS NetworkFlowMonitor service. It ensures that `boto3` interactions are type-checked by tools like `mypy`, preventing common runtime errors. The current version is `1.42.3`, and new versions are frequently released in sync with `boto3`/`botocore` updates and `mypy-boto3-builder` enhancements.
Warnings
- breaking Support for Python 3.8 has been removed from `mypy-boto3-builder` versions 8.12.0 and later, which affects all generated service stubs including `mypy-boto3-networkflowmonitor`.
- gotcha These type stubs require `mypy` (or another compatible type checker) to be installed and configured in your project to provide type checking benefits. Without `mypy`, they serve no runtime purpose.
- gotcha Type stubs are generated for specific `boto3`/`botocore` versions. Mismatching versions between your installed `boto3` and `mypy-boto3-networkflowmonitor` can lead to incorrect or missing type hints.
- gotcha The `mypy-boto3` ecosystem migrated to PEP 561-compliant packages. While this generally improves compatibility with type checkers and build tools, it might subtly affect very old or custom build environments.
Install
-
pip install mypy-boto3-networkflowmonitor boto3 mypy
Imports
- NetworkFlowMonitorClient
from mypy_boto3_networkflowmonitor import NetworkFlowMonitorClient
- ListNetworkFlowMonitorsOutputTypeDef
from mypy_boto3_networkflowmonitor.type_defs import ListNetworkFlowMonitorsOutputTypeDef
Quickstart
import boto3
from mypy_boto3_networkflowmonitor import NetworkFlowMonitorClient
from typing import TYPE_CHECKING
# Only import TypeDefs if you need them for specific annotations
if TYPE_CHECKING:
from mypy_boto3_networkflowmonitor.type_defs import (
ListNetworkFlowMonitorsOutputTypeDef,
)
def list_monitors():
# Instantiate the boto3 client, annotated with the stub type
client: NetworkFlowMonitorClient = boto3.client("network-flow-monitor")
# The 'response' object will now have type hints based on the stub
# For a real scenario, you might add error handling.
response = client.list_network_flow_monitors()
print(f"Found {len(response['NetworkFlowMonitorList'])} network flow monitors:")
for monitor in response['NetworkFlowMonitorList']:
print(f" - ARN: {monitor['NetworkFlowMonitorArn']}, Status: {monitor['Status']}")
if __name__ == "__main__":
# Ensure AWS credentials are configured for boto3
# (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, or ~/.aws/credentials)
list_monitors()