mypy-boto3-codestar-notifications Type Stubs
mypy-boto3-codestar-notifications provides comprehensive type annotations for the `boto3` client for AWS CodeStar Notifications service. It helps developers leverage static analysis tools like Mypy to catch type-related errors in their AWS SDK code. The library's current version is 1.42.3, and it is released frequently, tracking updates to `boto3` and the `mypy-boto3-builder`.
Warnings
- breaking Python 3.8 is no longer supported for any `mypy-boto3` packages generated by `mypy-boto3-builder` version 8.12.0 and later.
- gotcha `mypy-boto3-*` stub packages provide type annotations *only*. You must also install `boto3` (or `aiobotocore`/`aioboto3`) for the runtime functionality. Without `boto3`, your code will fail at runtime.
- gotcha For optimal type accuracy and to avoid potential mismatches, the version of `mypy-boto3-codestar-notifications` should ideally match the minor version of your `boto3` installation (e.g., `mypy-boto3-codestar-notifications==1.42.x` for `boto3==1.42.x`).
- breaking Internal TypeDef names for method arguments may have changed in `mypy-boto3-builder` 8.9.0. If you were directly importing and referencing these generated TypeDefs (e.g., `CreateDistributionRequestRequestTypeDef`), their names might have been shortened or suffixes reordered.
Install
-
pip install boto3 mypy-boto3-codestar-notifications
Imports
- CodeStarNotificationsClient
from mypy_boto3_codestar_notifications import CodeStarNotificationsClient
- ListNotificationRulesResultTypeDef
from mypy_boto3_codestar_notifications.type_defs import ListNotificationRulesResultTypeDef
Quickstart
import boto3
from mypy_boto3_codestar_notifications import CodeStarNotificationsClient
from mypy_boto3_codestar_notifications.type_defs import ListNotificationRulesResultTypeDef
# A boto3 session for runtime (not type-checked)
session = boto3.Session(region_name="us-east-1")
# Get a type-hinted CodeStarNotifications client
client: CodeStarNotificationsClient = session.client("codestar-notifications")
# Example API call with type-checked result
try:
result: ListNotificationRulesResultTypeDef = client.list_notification_rules()
print(f"Found {len(result.get('NotificationRules', []))} notification rules.")
# For demonstration, typically you'd iterate or check the rules
if result.get('NotificationRules'):
first_rule_name = result['NotificationRules'][0]['Name']
print(f"First rule name: {first_rule_name}")
except Exception as e:
print(f"Error listing notification rules: {e}")