Type annotations for boto3 ResourceGroups

1.42.3 · active · verified Sat Apr 11

mypy-boto3-resource-groups provides static type annotations for the AWS Resource Groups service within `boto3`, enabling robust type checking with tools like MyPy, Pyright, and enhanced IDE auto-completion. It is generated by `mypy-boto3-builder` and is part of a larger ecosystem of stub packages that closely track `boto3` releases, with frequent updates for new services and API changes.

Warnings

Install

Imports

Quickstart

This example demonstrates how to obtain a `boto3` client for AWS Resource Groups and apply explicit type annotations from `mypy-boto3-resource-groups` for improved static analysis and auto-completion. The actual `boto3` library is required at runtime.

import boto3
from mypy_boto3_resource_groups.client import ResourceGroupsClient
from typing import TYPE_CHECKING

# Ensure boto3 is installed (e.g., pip install boto3)

# Standard boto3 client creation
client = boto3.client("resource-groups")

# Type hint the client for static analysis (e.g., MyPy, IDEs)
# The 'if TYPE_CHECKING:' block ensures this import is only for type checking
# and doesn't cause runtime issues if the stub package isn't installed.
if TYPE_CHECKING:
    resource_groups_client: ResourceGroupsClient = client
else:
    resource_groups_client = client

# Now 'resource_groups_client' has full type annotations
# For example, calling an operation will show expected arguments and return types.
try:
    response = resource_groups_client.list_groups()
    print("Successfully listed Resource Groups.")
    # Example: print(response['GroupIdentifiers'])
except Exception as e:
    print(f"Error listing Resource Groups: {e}")

view raw JSON →