Type Annotations for boto3 CloudWatch Network Monitor
mypy-boto3-networkmonitor provides comprehensive type annotations for the `boto3` CloudWatch Network Monitor service (version 1.42.3). Generated by `mypy-boto3-builder` 8.12.0, it enhances developer experience by enabling static type checking with tools like mypy and pyright, and improving code completion in IDEs like VSCode and PyCharm. This library helps to proactively identify and fix potential type-related bugs in `boto3` code at development time.
Warnings
- breaking As of `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-networkmonitor 1.42.3`), Python 3.8 support has been officially removed for all generated packages.
- breaking Type definition (TypeDef) naming conventions changed in `mypy-boto3-builder` 8.9.0. This could affect code that explicitly imports or refers to TypeDefs by their full, verbose names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).
- gotcha The legacy `mypy-boto3` package was separated from the main `boto3-stubs` product in `mypy-boto3-builder` 8.9.0. Users upgrading from older `mypy-boto3` installations might find that new services or updates are not available via the old package.
- gotcha PyCharm users might experience slow performance or high CPU usage due to how PyCharm handles `Literal` overloads in `mypy-boto3` generated stubs (PyCharm issue PY-40997).
Install
-
pip install mypy-boto3-networkmonitor -
pip install 'boto3-stubs[networkmonitor]'
Imports
- NetworkMonitorClient
from mypy_boto3_networkmonitor.client import NetworkMonitorClient
- Paginator
from mypy_boto3_networkmonitor.paginator import ListMonitorsPaginator
- Literal
from mypy_boto3_networkmonitor.literals import MonitorStateTypeDef
- TypeDef
from mypy_boto3_networkmonitor.type_defs import MonitorSummaryTypeDef
Quickstart
import os
import boto3
from boto3.session import Session
from mypy_boto3_networkmonitor.client import NetworkMonitorClient
def get_network_monitor_client() -> NetworkMonitorClient:
# Assuming AWS credentials are set via environment variables or AWS CLI config
session = Session(region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1'))
client: NetworkMonitorClient = session.client("networkmonitor")
return client
client = get_network_monitor_client()
response = client.list_monitors()
print(response.get('Monitors'))