mypy-boto3-importexport
mypy-boto3-importexport provides type annotations for the AWS SDK for Python (boto3) ImportExport service. These type stubs enhance code completion, static analysis, and error detection for boto3 usage with tools like mypy, PyCharm, and VSCode. It is automatically generated by mypy-boto3-builder and is regularly updated to stay in sync with new boto3 releases and AWS API changes.
Warnings
- breaking Python 3.8 support has been removed. `mypy-boto3-builder` versions 8.12.0 and newer (which generate `mypy-boto3-importexport 1.42.3` and later) require Python 3.9 or higher. Projects on Python 3.8 must use older `mypy-boto3-importexport` versions or upgrade Python.
- breaking The `mypy-boto3-builder` migrated to PEP 561 compliant packages with version 8.12.0. This standardizes how type stubs are distributed and discovered. While generally a positive change, it might affect custom `mypy` configurations or build systems that relied on older stub discovery mechanisms.
- breaking Breaking changes to `TypeDef` naming conventions (e.g., removing redundant `Request` suffixes or changing `Extra` placement) were introduced in `mypy-boto3-builder 8.9.0`. While `importexport` might not be directly affected, other services could see altered `TypedDict` names, potentially breaking existing type annotations.
- gotcha For optimal IDE auto-completion and static analysis, it is recommended to explicitly type-hint `boto3.client` and `session.client` calls with the specific `Client` type (e.g., `ImportExportClient`). While `mypy` can often infer types, explicit annotations provide clearer guidance.
- gotcha When using Pylint with `mypy-boto3` stubs, you might encounter 'undefined variable' warnings for imported types (e.g., `ImportExportClient`) in runtime code. This happens because stubs are only for type-checking and not available at runtime.
- deprecated The `mypy-boto3` legacy packages have been moved to a separate product in `mypy-boto3-builder 8.9.0`. The recommended approach is to use `boto3-stubs` (which `mypy-boto3-importexport` is effectively a part of) or `types-boto3` for global stubs, or install individual service stubs directly.
Install
-
pip install mypy-boto3-importexport -
pip install 'boto3-stubs[importexport]' # Recommended for broader boto3 stub coverage -
pip install boto3
Imports
- ImportExportClient
from mypy_boto3_importexport import ImportExportClient
- ArtifactTypeDef
from mypy_boto3_importexport.type_defs import ArtifactTypeDef
- ListJobsPaginator
from mypy_boto3_importexport.paginator import ListJobsPaginator
Quickstart
import boto3
from mypy_boto3_importexport import ImportExportClient
from mypy_boto3_importexport.type_defs import JobTypeDef, ArtifactTypeDef
def get_import_export_client() -> ImportExportClient:
"""Returns a typed ImportExport client."""
# Actual credentials will be picked up by boto3 from environment variables or AWS config
session = boto3.Session(region_name="us-east-1")
return session.client("importexport")
def list_jobs(client: ImportExportClient) -> list[JobTypeDef]:
"""Lists ImportExport jobs."""
response = client.list_jobs(MaxJobs=5)
return response.get("Jobs", [])
if __name__ == "__main__":
client = get_import_export_client()
jobs = list_jobs(client)
if jobs:
print(f"Found {len(jobs)} ImportExport jobs:")
for job in jobs:
print(f" Job ID: {job.get('JobId')}, Type: {job.get('JobType')}, Status: {job.get('JobStatus')}")
else:
print("No ImportExport jobs found.")