Type Annotations for boto3 ManagedBlockchain
mypy-boto3-managedblockchain provides type annotations for the boto3 ManagedBlockchain service, enabling static type checking with tools like MyPy. It is currently at version 1.42.3 and is part of the `mypy-boto3` ecosystem, which releases frequently, often daily, to keep up with `boto3` and `botocore` updates and new AWS service features.
Warnings
- breaking Python 3.8 support was removed from version 8.12.0 onwards. All `mypy-boto3` packages now require Python 3.9 or higher.
- breaking TypeDef naming conventions changed in version 8.9.0, often resulting in shorter names for method arguments (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Custom type hints or direct usage of generated TypeDefs might break.
- gotcha The `mypy-boto3-managedblockchain` package provides only type stubs. You must also install `boto3` (the actual AWS SDK runtime) for your application to function correctly at runtime.
- gotcha Service names for `boto3.client()` calls can change over time (e.g., `sms-voice` became `pinpoint-sms-voice`). While `managedblockchain` is stable, be aware of this for other services, as `mypy-boto3` tracks these upstream changes.
Install
-
pip install boto3 mypy-boto3-managedblockchain
Imports
- ManagedBlockchainClient
from mypy_boto3_managedblockchain.client import ManagedBlockchainClient
- list_networks
client: ManagedBlockchainClient = boto3.client("managedblockchain"); client.list_networks()
Quickstart
import boto3
from mypy_boto3_managedblockchain.client import ManagedBlockchainClient
from mypy_boto3_managedblockchain.type_defs import ListNetworksOutputTypeDef
# Ensure you have AWS credentials configured, e.g., via environment variables or ~/.aws/credentials
# This example does not perform actual network requests, but uses type hints.
def get_managedblockchain_networks() -> ListNetworksOutputTypeDef:
# Type hint the boto3 client with the stub-provided client type
client: ManagedBlockchainClient = boto3.client("managedblockchain")
# Use a common ManagedBlockchain operation
response = client.list_networks(MaxResults=10)
print(f"Found {len(response['Networks'])} ManagedBlockchain networks.")
return response
if __name__ == "__main__":
# Example usage (this will require actual AWS credentials if uncommented and run)
# get_managedblockchain_networks()
# You can run `mypy your_script.py` to check types
pass # No runtime execution for quickstart to avoid credential requirement