Registry /
type-stubs / mypy-boto3-resource-explorer-2
Install & Compatibility
Where this runs
tested against v1.43.37 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 52MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.7s · import 0.000s · 53MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ResourceExplorer2Client
✓ from mypy_boto3_resource_explorer_2.client import ResourceExplorer2Client
ResourceExplorer2ServiceResource
✓ from mypy_boto3_resource_explorer_2.service_resource import ResourceExplorer2ServiceResource
SearchInputRequestTypeDef
✓ from mypy_boto3_resource_explorer_2.type_defs import SearchInputRequestTypeDef
This quickstart demonstrates how to obtain a type-hinted `ResourceExplorer2Client` using `boto3` and perform a search operation. It highlights the benefits of `mypy-boto3` by showing how type annotations guide parameter input and response parsing, improving code readability and maintainability.
import boto3
from mypy_boto3_resource_explorer_2.client import ResourceExplorer2Client
from mypy_boto3_resource_explorer_2.type_defs import SearchInputRequestTypeDef
import os
# Ensure boto3 is configured, e.g., via environment variables or ~/.aws/credentials
# For testing without actual credentials, you might mock boto3 or use a localstack setup.
def get_explorer_client() -> ResourceExplorer2Client:
"""Gets a type-hinted AWS Resource Explorer 2 client."""
# boto3.client expects a string for the service name
client: ResourceExplorer2Client = boto3.client("resource-explorer-2")
return client
def search_resources(client: ResourceExplorer2Client, query: str):
"""Performs a search using the Resource Explorer 2 client."""
print(f"Searching for resources with query: '{query}'")
search_params: SearchInputRequestTypeDef = {
"QueryString": query,
"MaxResults": 5
}
response = client.search(**search_params)
print("Found Resources:")
for resource in response.get("Resources", []):
print(f" - Name: {resource.get('ResourceArn')}, Type: {resource.get('ResourceType')}")
return response
if __name__ == "__main__":
# Example usage
explorer_client = get_explorer_client()
# An example query (replace with a real query for your AWS account)
# For a real run, ensure you have resources indexed by Resource Explorer 2.
test_query = "region:us-east-1 and resource.type:ec2:instance"
# This part will fail if AWS credentials are not configured or if Resource Explorer 2
# is not set up in your AWS account/region.
# For local testing, consider using localstack with boto3's endpoint_url.
try:
search_result = search_resources(explorer_client, test_query)
print(f"Search result has a NextToken: {search_result.get('NextToken') is not None}")
except Exception as e:
print(f"Error during search (this might be expected if AWS config/resources are not set up): {e}")
Debug
Known issues
breakingSupport for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Packages generated with this builder version (including `mypy-boto3-resource-explorer-2` 1.42.30) no longer support Python 3.8.fixUpgrade your Python environment to 3.9 or higher.
affects: mypy-boto3-builder >=8.12.0, mypy-boto3-resource-explorer-2 >=1.42.30
breakingCertain `TypeDef` names for method arguments were shortened or restructured in `mypy-boto3-builder` version 8.9.0. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.fixReview and update `TypeDef` names in your code to match the new, shorter conventions. Check the generated `type_defs.pyi` for the exact names.
affects: mypy-boto3-builder >=8.9.0, mypy-boto3-resource-explorer-2 >=1.34.0 (approximate)
gotchaInstalling `mypy-boto3-resource-explorer-2` only provides type annotations for static analysis tools like MyPy. It does NOT install `boto3` itself. You must install `boto3` separately to run your code.fixEnsure `boto3` is installed in your environment: `pip install boto3`.
affects: All versions
gotchaWhen obtaining a client from `boto3.client()`, you must pass the correct service name as a string (e.g., `'resource-explorer-2'`). The type hints are applied *after* the client is created, not by modifying how `boto3.client()` works.fixAlways use the official `boto3` service names as strings when calling `boto3.client()` or `boto3.resource()`.
affects: All versions
Upgrade
Version history
1.43.37latest on PyPI · released Jun 29, 2026
Audit
Dependencies
boto3requiredRuntime dependency for actual AWS SDK functionality; these stubs provide types for boto3 clients and resources.
types-botocore-resource-explorer-2requiredCore dependency for underlying botocore service definitions, installed automatically with this package.