mypy-boto3-panorama
mypy-boto3-panorama provides type annotations for the `boto3` Panorama service, ensuring static type checking for your AWS interactions. It is generated by `mypy-boto3-builder` and keeps pace with `boto3` releases, typically updating when `boto3` itself releases new versions or changes service APIs. The current version is 1.42.3.
Warnings
- breaking Python 3.8 support has been removed across all `mypy-boto3` packages, including `mypy-boto3-panorama`. Projects must use Python 3.9 or newer.
- breaking The `mypy-boto3` builder (which generates this package) migrated to PEP 561-compliant stub packages. This may affect some advanced build systems or `mypy` configurations, especially if you were relying on older stub distribution methods.
- breaking Generated TypeDef names for service methods were shortened and consolidated in older versions, potentially breaking direct imports of specific `TypeDef` aliases if they were impacted. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.
- gotcha For `mypy-boto3-panorama` to provide type checking, you *must* install both `boto3` (the runtime library) and `mypy-boto3-panorama` (the type stubs). Installing only one will result in either runtime errors or un-type-checked `boto3` calls.
Install
-
pip install mypy-boto3-panorama boto3
Imports
- PanoramaClient
from mypy_boto3_panorama.client import PanoramaClient
- ListApplicationInstancesOutputTypeDef
from mypy_boto3_panorama.type_defs import ListApplicationInstancesOutputTypeDef
- client
import boto3 client: PanoramaClient = boto3.client('panorama')
Quickstart
import os
import boto3
from mypy_boto3_panorama.client import PanoramaClient
from mypy_boto3_panorama.type_defs import ListApplicationInstancesOutputTypeDef
def list_panorama_instances(region: str = "us-east-1") -> ListApplicationInstancesOutputTypeDef:
"""Lists Panorama application instances with type checking."""
# Ensure boto3 is configured, e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
# or ~/.aws/credentials. For demonstration, we'll use environment variables.
client: PanoramaClient = boto3.client(
"panorama",
region_name=region,
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', '')
)
response: ListApplicationInstancesOutputTypeDef = client.list_application_instances()
print(f"Found {len(response.get('ApplicationInstances', []))} Panorama application instances.")
return response
if __name__ == "__main__":
try:
# This call will likely fail without proper AWS credentials/permissions.
# It demonstrates the type-checked interaction.
list_panorama_instances()
except Exception as e:
print(f"Error listing Panorama instances (expected if credentials/permissions are not set): {e}")