mypy-boto3-quicksight Type Stubs
mypy-boto3-quicksight provides static type annotations for the boto3 QuickSight service, generated by mypy-boto3-builder. It enhances development with type-checking capabilities for QuickSight operations. The library is actively maintained with frequent updates, often aligning with new boto3 releases and builder improvements. Current version is 1.42.80.
Warnings
- breaking Python 3.8 support was removed with `mypy-boto3-builder` version 8.12.0. If you are using Python 3.8, you must upgrade to Python 3.9 or newer to use the latest versions of these type stubs.
- gotcha This package provides only type stubs ('.pyi' files) for `boto3`. It does not include the actual `boto3` library or its runtime functionality. You must install `boto3` separately for your code to run.
- breaking The `mypy-boto3-builder` (version 8.9.0) introduced changes to how `TypeDef` names are generated, specifically shortening verbose names (e.g., `*RequestRequestTypeDef` to `*RequestTypeDef`). If your code directly imports specific `TypeDef`s, their names may have changed.
- gotcha The builder migrated to PEP 561 compliant packages in version 8.12.0. While this generally improves compatibility with type checkers by making stubs discoverable automatically, ensure your `mypy` configuration (e.g., `pyproject.toml`) is not relying on outdated, non-standard stub discovery mechanisms.
Install
-
pip install mypy-boto3-quicksight -
pip install 'boto3-stubs[quicksight]'
Imports
- QuickSightClient
from mypy_boto3_quicksight.client import QuickSightClient
- QuickSightServiceResource
from mypy_boto3_quicksight.service_resource import QuickSightServiceResource
- ListDashboardsOutputTypeDef
from mypy_boto3_quicksight.type_defs import ListDashboardsOutputTypeDef
Quickstart
import boto3
from mypy_boto3_quicksight.client import QuickSightClient
from typing import TYPE_CHECKING
import os
# Ensure boto3 is installed for runtime functionality
# pip install boto3 mypy-boto3-quicksight
if TYPE_CHECKING:
# Type-hint the boto3 client for QuickSight
client: QuickSightClient = boto3.client("quicksight")
else:
client = boto3.client("quicksight")
# Example: List dashboards (requires AWS credentials configured)
try:
print("Attempting to list QuickSight dashboards...")
# Replace '123456789012' with your actual AWS Account ID or set AWS_ACCOUNT_ID env var.
aws_account_id = os.environ.get('AWS_ACCOUNT_ID', '123456789012')
response = client.list_dashboards(
AwsAccountId=aws_account_id
)
dashboards = response.get("DashboardSummaryList", [])
if dashboards:
print(f"Found {len(dashboards)} dashboards. First dashboard name: {dashboards[0].get('Name')}")
else:
print(f"No dashboards found for AWS Account ID: {aws_account_id}, or the ID is invalid.")
except Exception as e:
print(f"An error occurred: {e}")
print("QuickSight client setup with type hints successful.")