mypy-boto3-snowball
Type annotations for boto3 Snowball 1.42.3 service generated with mypy-boto3-builder 8.12.0. This library provides static type checking for `boto3` clients and resources, enhancing development with autocompletion and early error detection for AWS Snowball operations. It follows `boto3`'s release cadence, with frequent updates to align with new AWS service versions.
Warnings
- breaking Python 3.8 support has been removed since mypy-boto3-builder version 8.12.0. Ensure your project uses Python 3.9 or newer to utilize the latest `mypy-boto3-snowball` versions.
- breaking mypy-boto3-builder version 8.9.0 introduced breaking changes in TypeDef naming conventions, potentially affecting existing type-hinted code. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.
- gotcha Legacy `mypy-boto3` (the monolithic package) has been moved to a separate product by the builder in version 8.9.0. Users should explicitly install service-specific packages (e.g., `mypy-boto3-snowball`) or `boto3-stubs` with extras.
- gotcha PyCharm may experience slow performance or high CPU usage due to `Literal` overloads in `mypy-boto3` stubs. This is a known issue (PY-40997).
- gotcha While `mypy-boto3` often provides implicit type discovery, explicit type annotations for clients, paginators, and waiters can improve clarity and sometimes be necessary, especially when using `lite` versions of the stubs.
Install
-
pip install mypy-boto3-snowball -
pip install 'boto3-stubs[snowball]'
Imports
- SnowballClient
from mypy_boto3_snowball.client import SnowballClient
- AddressTypeDef
from mypy_boto3_snowball.type_defs import AddressTypeDef
- AddressTypeType
from mypy_boto3_snowball.literals import AddressTypeType
- Session
from boto3.session import Session
Quickstart
import boto3
from typing import TYPE_CHECKING
from mypy_boto3_snowball.client import SnowballClient
def get_snowball_jobs():
# Use TYPE_CHECKING guard to avoid runtime dependency on mypy-boto3-snowball
if TYPE_CHECKING:
client: SnowballClient = boto3.client("snowball")
else:
client = boto3.client("snowball")
try:
response = client.list_jobs(
MaxResults=10,
# NextToken='string' # Uncomment if you have a next token
)
print(f"Snowball Jobs: {response.get('JobListEntries')}")
return response.get('JobListEntries', [])
except client.exceptions.InvalidResourceException as e:
print(f"Error: {e}")
return []
if __name__ == "__main__":
# Ensure AWS credentials are configured (e.g., via ~/.aws/credentials or environment variables)
# For local testing, you might need a mock boto3 or actual AWS setup.
print("Attempting to list Snowball jobs...")
jobs = get_snowball_jobs()