Registry / type-stubs / mypy-boto3-cloudwatch

mypy-boto3-cloudwatch

JSON →
library1.43.78pypypi✓ verified 23d ago

mypy-boto3-cloudwatch provides type annotations for the `boto3` CloudWatch service, generated by `mypy-boto3-builder`. It enhances development with static type checking, autocompletion, and bug detection for `boto3` CloudWatch clients. The library is actively maintained with frequent updates to align with new `boto3` versions.

pip install mypy-boto3-cloudwatch boto3
INSTALL
IMPORT
SIG · MYPY-BOTO3-CLOUDWA
M
mypy-boto3-cloudwatch
type-stubspythonv1.43.78
Install
3.8s avg
Import
823ms
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.78 · 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.868s · 52.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.8s · import 0.778s · 53MB
51MB installed
● package 51MB
Code
Verified usage

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

CloudWatchClient
from mypy_boto3_cloudwatch.client import CloudWatchClient
Import the specific client type for detailed type hints.
PutMetricDataInputRequestTypeDef
from mypy_boto3_cloudwatch.type_defs import PutMetricDataInputRequestTypeDef
Import TypeDefs for precise type checking of request/response structures.

This quickstart demonstrates how to instantiate a `boto3` CloudWatch client with explicit type hints from `mypy-boto3-cloudwatch` and how to use a generated TypeDef for a method's input parameters.

import boto3 from mypy_boto3_cloudwatch.client import CloudWatchClient from mypy_boto3_cloudwatch.type_defs import PutMetricDataInputRequestTypeDef # Instantiate a CloudWatch client with type annotation client: CloudWatchClient = boto3.client( "cloudwatch", region_name="us-east-1", aws_access_key_id="AKIATESTKEY", # Use os.environ.get('AWS_ACCESS_KEY_ID', '') in real code aws_secret_access_key="YOUR_SECRET_KEY" # Use os.environ.get('AWS_SECRET_ACCESS_KEY', '') in real code ) # Example of using a TypeDef for a request payload metric_data: PutMetricDataInputRequestTypeDef = { "Namespace": "MyApplication", "MetricData": [ { "MetricName": "CustomMetric", "Dimensions": [ {"Name": "Environment", "Value": "Production"} ], "Value": 10.5, "Unit": "Count", } ], } try: response = client.put_metric_data(**metric_data) print(f"Successfully put metric data: {response['ResponseMetadata']['HTTPStatusCode']}") except Exception as e: print(f"Error putting metric data: {e}")
Debug
Known issues
breakingPython 3.8 support has been removed since version 8.12.0 of `mypy-boto3-builder` (which generates this package). Ensure your project uses Python 3.9 or higher.
fix
Upgrade your Python environment to 3.9+.
affects: >=8.12.0
breakingThe `mypy-boto3` ecosystem has migrated to PEP 561-compatible packages since builder version 8.12.0. This means you should now directly install `mypy-boto3-cloudwatch` rather than relying on `boto3-stubs` for service-specific types.
fix
Ensure you `pip install mypy-boto3-cloudwatch` directly. If you were using `boto3-stubs[cloudwatch]`, switch to the direct package.
affects: >=8.12.0
breakingBreaking changes in `mypy-boto3-builder` 8.9.0 introduced shorter TypeDef names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and moved `Extra` postfixes. If you directly imported and used these TypeDefs, your code may break.
fix
Review your TypeDef imports and usages, adjusting names according to the new conventions.
affects: >=8.9.0
gotchaThis package provides *only* type annotations. You must install `boto3` separately to have the runtime functionality for interacting with AWS services.
fix
Ensure `boto3` is installed in your environment: `pip install boto3`.
affects: *
gotchaWhile explicit type annotations are often beneficial, recent `mypy-boto3` versions offer auto-discovery for `boto3.client` and `boto3.resource` calls. Your IDE (e.g., VSCode with Pylance, PyCharm with mypy plugin) should pick up types automatically without explicit imports of `CloudWatchClient` in many cases.
fix
Consider simplifying your type hinting where auto-discovery works, but explicit imports provide the most robust type checking.
affects: >=8.7.0
gotchaFor Pylint compatibility and to avoid runtime dependencies on `mypy-boto3-cloudwatch` in production, it is recommended to guard type imports with `if TYPE_CHECKING:` to set types to `object` at runtime.
fix
Wrap type-specific imports with `from typing import TYPE_CHECKING` and define runtime fallbacks: `if TYPE_CHECKING: from mypy_boto3_cloudwatch.client import CloudWatchClient else: CloudWatchClient = object`.
affects: *
Upgrade
Version history
1.43.78latest on PyPI · released Aug 21, 2026
Audit
Dependencies
boto3requiredRuntime dependency for AWS SDK functionality. mypy-boto3-cloudwatch only provides type stubs.
Agent activity
17 hits · last 30 days
node
12
OpenAI (training)
1
Resources
mypy-boto3-cloudwatch — pip install mypy-boto3-cloudwatch · libregistry