mypy-boto3-lookoutequipment
mypy-boto3-lookoutequipment provides type annotations for the `boto3` AWS SDK's LookoutEquipment service, ensuring static type checking with tools like `mypy`. This enhances code quality, improves developer experience with IDE autocompletion, and helps catch potential bugs before runtime. The package is generated by `mypy-boto3-builder 8.12.0` and follows the `boto3` versioning for its type stubs, with frequent updates to align with new `boto3` releases.
Warnings
- breaking Support for Python 3.8 was removed with `mypy-boto3-builder` version 8.12.0. Projects using Python 3.8 will need to upgrade their Python version or pin to an older `mypy-boto3-lookoutequipment` version.
- breaking The `mypy-boto3-builder` (and thus generated packages) migrated to PEP 561-compliant distribution. While this generally improves compatibility with `mypy`, some non-standard build setups or older `mypy` versions might require adjustments to properly discover the stubs.
- breaking TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. TypeDefs for packed method arguments may use shorter names, and 'Extra' postfixes were moved. This can cause type-checking errors if you explicitly imported and used these TypeDefs in previous versions.
- gotcha PyCharm users might experience slow performance with Literal overloads when using the full `boto3-stubs` package. `boto3-stubs-lite` is recommended as a workaround, though it requires more explicit type annotations.
- gotcha This package only provides type annotations. The actual `boto3` library must be installed and correctly configured with AWS credentials for the code to run successfully at runtime.
Install
-
pip install mypy-boto3-lookoutequipment -
pip install 'boto3-stubs[lookoutequipment]'
Imports
- LookoutEquipmentClient
from mypy_boto3_lookoutequipment.client import LookoutEquipmentClient
- CreateDatasetResponseTypeDef
from mypy_boto3_lookoutequipment.type_defs import CreateDatasetResponseTypeDef
- boto3.client('lookoutequipment')
import boto3 client: LookoutEquipmentClient = boto3.client('lookoutequipment')
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_lookoutequipment.client import LookoutEquipmentClient
from mypy_boto3_lookoutequipment.type_defs import ListDatasetsResponseTypeDef
def list_lookout_equipment_datasets() -> 'ListDatasetsResponseTypeDef':
"""Lists LookoutEquipment datasets and returns a typed response."""
# boto3 client is dynamically typed, mypy-boto3 provides static types
client: LookoutEquipmentClient = boto3.client("lookoutequipment")
# The response is automatically typed by mypy-boto3
response = client.list_datasets()
print(f"Found {len(response['DatasetSummaries'])} datasets.")
return response
if __name__ == "__main__":
# Example usage (requires AWS credentials configured)
try:
datasets = list_lookout_equipment_datasets()
for dataset in datasets.get('DatasetSummaries', []):
print(f"- Dataset ARN: {dataset['DatasetArn']}, Name: {dataset['DatasetName']}")
except Exception as e:
print(f"Error listing datasets: {e}")
print("Please ensure AWS credentials are configured (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION_NAME environment variables).")