{"id":3105,"library":"mypy-boto3-ivs-realtime","title":"mypy-boto3-ivs-realtime","description":"mypy-boto3-ivs-realtime provides comprehensive type annotations for the AWS IVS Realtime service within the boto3 library. Currently at version 1.42.86, it is part of the mypy-boto3-builder ecosystem, which generates and releases type stubs frequently, often in sync with new boto3 releases, ensuring up-to-date type checking for AWS services.","status":"active","version":"1.42.86","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","mypy","type-stubs","ivs-realtime","type-checking","python"],"install":[{"cmd":"pip install mypy-boto3-ivs-realtime boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This package provides type stubs for the boto3 library; boto3 must be installed for runtime execution.","package":"boto3","optional":false},{"reason":"Requires Python 3.9 or newer.","package":"python","optional":false}],"imports":[{"note":"Type stubs are imported from the mypy_boto3_* package, not directly from boto3.","wrong":"from boto3.client import IVSRealTimeClient","symbol":"IVSRealTimeClient","correct":"from mypy_boto3_ivs_realtime.client import IVSRealTimeClient"},{"note":"Explicit type annotation on the client creation is highly recommended for full type-checking benefits, especially with boto3-stubs-lite or older IDE versions.","wrong":"client = boto3.client('ivs-realtime')","symbol":"IVSRealTimeClient","correct":"client: IVSRealTimeClient = boto3.client('ivs-realtime')"}],"quickstart":{"code":"import boto3\nimport os\nfrom typing import TYPE_CHECKING\n\n# Only import type stubs when type checking\nif TYPE_CHECKING:\n    from mypy_boto3_ivs_realtime.client import IVSRealTimeClient\n    from mypy_boto3_ivs_realtime.type_defs import CreateParticipantTokenResponseTypeDef\n\n\ndef get_participant_token(channel_arn: str, user_id: str) -> dict:\n    \"\"\"Generates a participant token for an IVS Real-time channel.\"\"\"\n    # Explicitly type the client for mypy to provide full benefits\n    client: 'IVSRealTimeClient' = boto3.client(\n        'ivs-realtime',\n        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),\n        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),\n        region_name=os.environ.get('AWS_REGION', 'us-east-1')\n    )\n\n    response: 'CreateParticipantTokenResponseTypeDef' = client.create_participant_token(\n        channelArn=channel_arn,\n        userId=user_id\n    )\n    return response\n\n# Example usage (will not run without AWS credentials and a valid channel ARN)\nif __name__ == \"__main__\":\n    EXAMPLE_CHANNEL_ARN = os.environ.get('IVS_REALTIME_CHANNEL_ARN', 'arn:aws:ivs:us-east-1:123456789012:channel/abcdefghijkL')\n    EXAMPLE_USER_ID = 'test-user-123'\n\n    print(f\"Attempting to get participant token for channel: {EXAMPLE_CHANNEL_ARN}, user: {EXAMPLE_USER_ID}\")\n    try:\n        # This call will fail without actual AWS credentials and a valid ARN\n        token_info = get_participant_token(EXAMPLE_CHANNEL_ARN, EXAMPLE_USER_ID)\n        print(\"Successfully received token info (type-checked):\")\n        print(token_info)\n    except Exception as e:\n        print(f\"Error generating token: {e}\")\n        print(\"Please ensure AWS credentials and a valid IVS Real-time channel ARN are set as environment variables.\")","lang":"python","description":"This quickstart demonstrates how to set up an IVS Real-time client with type annotations and generate a participant token. It uses `TYPE_CHECKING` for conditional import of stubs, ensuring they are only used during type checking. The client is explicitly typed to leverage the full capabilities of `mypy-boto3-ivs-realtime`. Replace placeholder values with actual AWS credentials and a valid IVS Real-time channel ARN."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later.","message":"Python 3.8 support has been removed since `mypy-boto3-builder 8.12.0`. All generated `mypy-boto3-*` packages, including `mypy-boto3-ivs-realtime`, now require Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0"},{"fix":"Update explicit TypeDef imports and annotations in your code to reflect the new, shorter naming conventions.","message":"TypeDef naming conventions changed in `mypy-boto3-builder 8.9.0`. Argument TypeDefs for packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). Conflicting `Extra` postfixes were also moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0"},{"fix":"Ensure `boto3` is installed in your project environment alongside `mypy-boto3-ivs-realtime`.","message":"This package provides *type stubs* for `boto3`. It does not include the `boto3` library itself. You must install `boto3` separately (e.g., `pip install boto3`) for your code to run at runtime.","severity":"gotcha","affected_versions":"All"},{"fix":"Add explicit type hints to your `boto3.client()` and `boto3.resource()` calls, using the client/resource types imported from the `mypy_boto3_*` package.","message":"Explicit type annotations for `boto3.client()` calls are recommended (`client: IVSRealTimeClient = boto3.client('ivs-realtime')`). While some IDEs and `mypy` might infer types, explicit annotation ensures full type-checking benefits, especially when using `boto3-stubs-lite` or standalone service packages, and can mitigate performance issues in IDEs like PyCharm with Literal overloads.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}