Registry / type-stubs / mypy-boto3-compute-optimizer-automation

mypy-boto3-compute-optimizer-automation

JSON →
library1.43.32pypypi✓ verified 22d ago

This library provides type annotations (stubs) for the `boto3` AWS SDK, specifically for the `ComputeOptimizerAutomation` service. It enables static type checking with tools like Mypy and enhances IDE auto-completion for `boto3` operations, improving code quality and reducing runtime errors. The current version is 1.42.3, and it is part of the frequently updated `mypy-boto3-builder` project.

pip install mypy-boto3-compute-optimizer-automation
INSTALL
IMPORT
SIG · MYPY-BOTO3-COMPUTE
M
mypy-boto3-compute-optimizer-automation
type-stubspythonv1.43.32
Install
2.7s avg
Import
Disk
71MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.32 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 2.7s · import 0.000s · 19MB
71MB installed
● package 71MB
Code
Verified usage

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

ComputeOptimizerAutomationClient
from mypy_boto3_compute_optimizer_automation import ComputeOptimizerAutomationClient
from mypy_boto3_compute_optimizer_automation import ComputeOptimizerAutomationClient

This quickstart demonstrates how to initialize a type-hinted `ComputeOptimizerAutomationClient` and use it to list automation rules, leveraging type annotations for improved developer experience and static analysis. It uses environment variables for AWS credentials, suitable for local execution and CI/CD pipelines.

import os from typing import TYPE_CHECKING import boto3 # These imports are only for type checking, not for runtime execution if TYPE_CHECKING: from mypy_boto3_compute_optimizer_automation import ComputeOptimizerAutomationClient from mypy_boto3_compute_optimizer_automation.type_defs import ListAutomationRulesResponseTypeDef def get_compute_optimizer_automation_client() -> "ComputeOptimizerAutomationClient": """ Provides a type-hinted ComputeOptimizerAutomation client. Ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set in environment. """ session = boto3.Session( aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID", "dummy"), aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY", "dummy"), region_name=os.environ.get("AWS_REGION", "us-east-1") ) return session.client("compute-optimizer-automation") def list_all_automation_rules(): """Lists all Compute Optimizer Automation rules with type hints.""" # Explicitly type the client for better IDE support and type checking client: ComputeOptimizerAutomationClient = get_compute_optimizer_automation_client() print("Attempting to list Compute Optimizer Automation Rules...") try: # Type the response for detailed type checking of the result response: ListAutomationRulesResponseTypeDef = client.list_automation_rules() rules = response.get("AutomationRules", []) if rules: print("Compute Optimizer Automation Rules found:") for rule in rules: print(f" - Name: {rule.get('RuleName', 'N/A')}, ARN: {rule.get('RuleArn', 'N/A')}") else: print("No Compute Optimizer Automation rules found.") if response.get("NextToken"): print(" (More rules available, consider using a paginator for a full list)") except Exception as e: print(f"Error listing rules: {e}") print("Please ensure your AWS credentials and region are correctly configured.") if __name__ == "__main__": # Set dummy environment variables if not already set for runnable example # In a real scenario, these should be valid AWS credentials os.environ.setdefault('AWS_ACCESS_KEY_ID', 'AKIAIOSFODNN7EXAMPLE') os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY') os.environ.setdefault('AWS_REGION', 'us-east-1') list_all_automation_rules()
Debug
Known issues
breakingPython 3.8 support was removed from `mypy-boto3-builder` version `8.12.0` (which generates these stubs). Projects using this library now require Python 3.9 or newer.
fix
Upgrade your Python environment to 3.9 or later.
affects: mypy-boto3-builder >= 8.12.0
breakingIn `mypy-boto3-builder` version `8.9.0`, TypeDef naming conventions were changed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This might break existing explicit type annotations in your code.
fix
Update your TypeDef imports and variable annotations to reflect the new, shorter naming convention.
affects: mypy-boto3-builder >= 8.9.0
gotchaThis package provides *type stubs* for static analysis with tools like Mypy or IDEs. It does *not* include the `boto3` library itself. `boto3` must be installed separately for your application to run at runtime.
fix
Ensure `boto3` is installed in your project: `pip install boto3`.
affects: All
gotchaFor optimal IDE support (VSCode, PyCharm) and robust static type checking, it is often recommended to use *explicit type annotations* for `boto3.client` and `boto3.session.client` calls, rather than relying solely on implicit type discovery.
fix
Add explicit type hints, e.g., `client: ComputeOptimizerAutomationClient = session.client("compute-optimizer-automation")`, and import the client type from `mypy_boto3_compute_optimizer_automation`.
affects: All
gotchaWhen using `mypy-boto3` packages with `pylint`, you might encounter 'undefined variable' warnings if types are guarded by `if TYPE_CHECKING:`. A common workaround is to conditionally set types to `object` outside of the `TYPE_CHECKING` block to satisfy `pylint`.
fix
Implement conditional type declarations: `if TYPE_CHECKING: from mypy_boto3_... import ClientType else: ClientType = object`.
affects: All (with Pylint)
Upgrade
Version history
1.43.32latest on PyPI · released Jun 17, 2026
Audit
Dependencies
boto3requiredProvides the underlying AWS SDK for which these are type stubs. Required for runtime execution.
Agent activity
18 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
mypy-boto3-compute-optimizer-automation — pip install mypy-boto3-compute-optimizer-automation · libregistry