{"id":3671,"library":"mypy-boto3-personalize","title":"mypy-boto3-personalize: Type Annotations for AWS Personalize","description":"mypy-boto3-personalize provides comprehensive type annotations for the AWS Personalize service in `boto3`. It enhances static analysis with tools like MyPy, catching potential type-related errors before runtime. The current version is 1.42.3, tracking `boto3` releases, and is part of the frequently updated `mypy-boto3-builder` ecosystem.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","personalize","mypy","type-hints","stubs","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-personalize boto3 mypy","lang":"bash","label":"Install with core dependencies"}],"dependencies":[{"reason":"Provides the runtime AWS SDK that these stubs type-check.","package":"boto3","optional":false},{"reason":"The primary static type checker used to leverage these stubs.","package":"mypy","optional":false},{"reason":"Required for some type features on Python < 3.9, automatically handled by builder.","package":"typing_extensions","optional":true}],"imports":[{"symbol":"PersonalizeClient","correct":"from mypy_boto3_personalize.client import PersonalizeClient"},{"note":"Alias for PersonalizeClient.","symbol":"Client","correct":"from mypy_boto3_personalize.client import Client"},{"symbol":"CreateDatasetRequestRequestTypeDef","correct":"from mypy_boto3_personalize.type_defs import CreateDatasetRequestRequestTypeDef"},{"symbol":"CreateDatasetResponseTypeDef","correct":"from mypy_boto3_personalize.type_defs import CreateDatasetResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_personalize.client import PersonalizeClient\n\n# mypy-boto3-personalize provides type hints for the boto3 client.\n# You still use the standard boto3 client at runtime.\n\n# Configure AWS credentials as usual (e.g., ~/.aws/credentials, environment variables)\n\n# Instantiate a boto3 client and apply the type hint\npersonalize_client: PersonalizeClient = boto3.client(\"personalize\")\n\nprint(f\"Client type successfully inferred by mypy-boto3-personalize: {type(personalize_client)}\")\n\n# Example of how type hints are used for method calls (for static analysis).\n# This code block is for demonstration of type-checking, not intended for live execution\n# without proper setup and AWS resources.\n\n# from mypy_boto3_personalize.type_defs import CreateDatasetRequestRequestTypeDef\n\n# try:\n#     # Type checkers like MyPy will ensure 'name', 'datasetGroupArn', etc. are correct types\n#     # and that the return value matches CreateDatasetResponseTypeDef.\n#     create_request: CreateDatasetRequestRequestTypeDef = {\n#         \"name\": \"MyNewDataset\",\n#         \"datasetGroupArn\": \"arn:aws:personalize:us-east-1:123456789012:dataset-group/my-group\",\n#         \"datasetType\": \"ITEMS\",\n#         \"schemaArn\": \"arn:aws:personalize:us-east-1:123456789012:schema/my-schema\",\n#     }\n#     response = personalize_client.create_dataset(**create_request)\n#     print(f\"Type-checked call example response: {response}\")\n# except Exception as e:\n#     print(f\"Example call failed (expected without real AWS setup): {e}\")","lang":"python","description":"This quickstart demonstrates how to import and apply type hints for the AWS Personalize client using `mypy-boto3-personalize`. It shows the typical pattern of instantiating a `boto3` client and then annotating it with the provided `PersonalizeClient` type, enabling static type checking for your AWS SDK interactions."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer, or pin `mypy-boto3-personalize` to an older version compatible with Python 3.8 (e.g., `<1.42.3`).","message":"Starting with `mypy-boto3-builder` 8.12.0, Python 3.8 is no longer supported across all `mypy-boto3` packages, including `mypy-boto3-personalize`. Users on Python 3.8 must upgrade to Python 3.9+ or pin an older version of `mypy-boto3-personalize`.","severity":"breaking","affected_versions":">=8.12.0 (builder), effectively mypy-boto3-personalize versions generated after builder 8.12.0"},{"fix":"Review your explicit TypeDef import and usage statements and adjust names according to the new conventions. Consult the `mypy-boto3-personalize.type_defs` module for the correct names.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. Specifically, `RequestTypeDef` for method arguments might be shortened (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). This can break explicit type hints for these TypeDefs.","severity":"breaking","affected_versions":">=8.9.0 (builder), effectively mypy-boto3-personalize versions generated after builder 8.9.0"},{"fix":"Ensure both `boto3` and `mypy` are installed alongside `mypy-boto3-personalize` using `pip install mypy-boto3-personalize boto3 mypy`.","message":"`mypy-boto3-personalize` provides only type stubs, not the actual runtime library. You *must* install `boto3` separately for your code to run, and `mypy` to perform static analysis. Not installing `boto3` will lead to runtime `ModuleNotFoundError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Check your `mypy` configuration (`pyproject.toml`, `mypy.ini`, or command-line arguments). Ensure `mypy` is running in an environment where `mypy-boto3-personalize` is installed. For advanced scenarios, explicitly specify `mypy` paths if needed.","message":"While `mypy-boto3` packages are PEP 561 compliant, `mypy` might not always automatically discover stubs in complex project setups or older `mypy` versions. Ensure `mypy` is correctly configured to find the installed type packages.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}