{"id":3669,"library":"mypy-boto3-personalize-events","title":"Type Annotations for boto3 PersonalizeEvents","description":"mypy-boto3-personalize-events provides type annotations for the `boto3` PersonalizeEvents service, enabling static type checking with tools like MyPy, PyRight, and improved IDE auto-completion. It is part of the `mypy-boto3` project, which generates stubs for all `boto3` services. This package is currently at version 1.42.3, generated with `mypy-boto3-builder 8.12.0`, and follows a frequent release cadence, often aligning with `boto3` and `mypy-boto3-builder` updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hinting","stubs","personalize-events","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-personalize-events","lang":"bash","label":"Install standalone stubs"},{"cmd":"pip install \"boto3-stubs[personalize-events]\"","lang":"bash","label":"Install via boto3-stubs meta-package"}],"dependencies":[{"reason":"This package provides type stubs for boto3; boto3 itself must be installed and available at runtime.","package":"boto3","optional":false},{"reason":"Core dependency for generated stubs, contains shared type definitions. This is an implicit dependency if installing the service-specific package.","package":"boto3-stubs-extracted","optional":false}],"imports":[{"symbol":"PersonalizeEventsClient","correct":"from mypy_boto3_personalize_events.client import PersonalizeEventsClient"},{"symbol":"PutEventsRequestRequestTypeDef","correct":"from mypy_boto3_personalize_events.type_defs import PutEventsRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nimport os\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_personalize_events.client import PersonalizeEventsClient\n    from mypy_boto3_personalize_events.type_defs import PutEventsRequestRequestTypeDef\n\ndef process_personalize_events(session: boto3.Session) -> None:\n    # Client is explicitly typed for full IDE support and static analysis\n    client: PersonalizeEventsClient = session.client(\"personalize-events\")\n\n    # Example: Put events\n    event_data: PutEventsRequestRequestTypeDef = {\n        \"trackingId\": \"your-tracking-id\",\n        \"sessionId\": \"user-session-id-123\",\n        \"eventList\": [\n            {\n                \"eventId\": \"event-id-1\",\n                \"eventType\": \"Purchase\",\n                \"itemId\": \"item-id-101\",\n                \"sentAt\": \"2026-04-11T13:00:00Z\",\n                \"properties\": \"{\\\"price\\\": 10.99}\"\n            }\n        ]\n    }\n    \n    response = client.put_events(**event_data)\n    print(f\"PutEvents response: {response}\")\n\nif __name__ == \"__main__\":\n    # Use environment variables for credentials in production\n    aws_session = boto3.Session(\n        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),\n        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),\n        region_name=os.environ.get('AWS_REGION', 'us-east-1')\n    )\n    process_personalize_events(aws_session)","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` PersonalizeEvents client with explicit type hints from `mypy-boto3-personalize-events` and perform a `put_events` operation. It includes a `TYPE_CHECKING` guard to ensure the stub dependency is only active during type checking, not runtime, and uses environment variables for AWS credentials."},"warnings":[{"fix":"Upgrade to Python 3.9 or higher to continue receiving updates and full type-checking support.","message":"Support for Python 3.8 was officially removed for all `mypy-boto3` packages with `mypy-boto3-builder` version 8.12.0.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Review and update TypeDef names in your code if you are upgrading from an older `mypy-boto3-builder` version and were using these specific type definitions.","message":"Some generated TypeDefs for method arguments were renamed for brevity (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`) in `mypy-boto3-builder` 8.9.0. Similarly, conflicting TypeDef `Extra` postfixes were moved to the end.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Always explicitly type the client or resource object upon creation, e.g., `client: PersonalizeEventsClient = session.client('personalize-events')`.","message":"When using standalone packages like `mypy-boto3-personalize-events` or `boto3-stubs-lite`, explicit type annotations for `session.client()` and `session.resource()` calls are often necessary in IDEs (like VSCode with Pylance) to ensure full auto-completion and correct type inference.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider installing `boto3-stubs-lite` (e.g., `pip install 'boto3-stubs-lite[personalize-events]'`) and using explicit type annotations, or use a different IDE.","message":"PyCharm users might experience performance issues due to its handling of `Literal` overloads. For better performance, especially in larger projects, `boto3-stubs-lite` is recommended over full `boto3-stubs` or standalone 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"}