{"id":3092,"library":"mypy-boto3-gamelift","title":"mypy-boto3-gamelift: Type Annotations for AWS GameLift","description":"mypy-boto3-gamelift provides comprehensive type annotations for the boto3 AWS GameLift service. It enhances development experience by enabling static type checking for GameLift client methods and response/request structures. Currently at version 1.42.82, it is generated by the mypy-boto3-builder and generally releases new versions in sync with upstream boto3 and builder updates.","status":"active","version":"1.42.82","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","gamelift","types","mypy","type-annotations","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-gamelift boto3","lang":"bash","label":"Install type stubs and boto3"}],"dependencies":[{"reason":"This package provides type stubs for boto3; boto3 itself is required for runtime execution.","package":"boto3"}],"imports":[{"note":"Type stubs are provided by mypy-boto3-gamelift, not directly by boto3 itself.","wrong":"from boto3.client import GameLiftClient","symbol":"GameLiftClient","correct":"from mypy_boto3_gamelift import GameLiftClient"},{"note":"Client is a common alias for the service client type.","symbol":"Client","correct":"from mypy_boto3_gamelift import Client"},{"note":"Type definition naming conventions were adjusted in builder v8.9.0, leading to shorter names for some TypeDefs.","wrong":"from mypy_boto3_gamelift.type_defs import CreateGameSessionRequestRequestTypeDef","symbol":"CreateGameSessionInputRequestTypeDef","correct":"from mypy_boto3_gamelift.type_defs import CreateGameSessionInputRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_gamelift import Client\nfrom typing import TYPE_CHECKING\n\n# Best practice: use TYPE_CHECKING for type imports to avoid runtime import overhead\nif TYPE_CHECKING:\n    from mypy_boto3_gamelift.type_defs import CreateGameSessionInputRequestTypeDef\n\ndef create_gamelift_session(alias_id: str, capacity: int, region: str = \"us-east-1\") -> dict:\n    client: Client = boto3.client(\"gamelift\", region_name=region)\n    \n    # Example using a typed request body (if TYPE_CHECKING is True)\n    request_body: 'CreateGameSessionInputRequestTypeDef' = {\n        'MaximumPlayerSessionCount': capacity,\n        'AliasId': alias_id\n        # 'FleetId': 'YOUR_FLEET_ID' # Add FleetId if not using AliasId\n    }\n    \n    try:\n        response = client.create_game_session(**request_body)\n        print(f\"Game session created: {response['GameSession']['GameSessionId']}\")\n        return response\n    except client.exceptions.ConflictException as e:\n        print(f\"Error creating game session: {e}\")\n        raise\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")\n        raise\n\n# Example usage (replace with actual values):\n# if __name__ == \"__main__\":\n#     try:\n#         create_gamelift_session(alias_id=\"alias-xxxxxxx\", capacity=10, region=\"us-west-2\")\n#     except Exception:\n#         print(\"Failed to create game session.\")","lang":"python","description":"This quickstart demonstrates how to initialize a type-hinted AWS GameLift client and use it to create a game session. It showcases importing the `Client` type and an example `TypeDef` for request parameters, ensuring static type checking for your boto3 interactions."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. The package's `requires_python` metadata is `>=3.9`.","message":"Support for Python 3.8 was removed from `mypy-boto3-builder` (and consequently generated `mypy-boto3` packages including `mypy-boto3-gamelift`) in version 8.12.0.","severity":"breaking","affected_versions":"mypy-boto3-gamelift >= 1.42.82 (generated by builder >= 8.12.0)"},{"fix":"Ensure `pip install boto3` is run in your project's environment.","message":"This package provides only type annotations. The actual `boto3` library is a separate runtime dependency and must be installed alongside `mypy-boto3-gamelift` for your code to execute.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your code for direct imports of specific `type_defs` and adjust names according to the latest generated stubs. Consult `mypy-boto3-builder` release notes for details on affected naming patterns.","message":"Type Definition (TypeDef) names for request/response bodies were sometimes shortened or had postfixes reordered in `mypy-boto3-builder` version 8.9.0. If you explicitly imported specific `type_defs` in previous versions, these names may have changed.","severity":"breaking","affected_versions":"mypy-boto3-gamelift >= 1.42.82 (generated by builder >= 8.9.0)"},{"fix":"Refer to the `mypy-boto3-builder` release notes or `boto3` documentation for any service-specific changes when upgrading.","message":"The `mypy-boto3` ecosystem closely tracks AWS service APIs. Specific services may be renamed or removed from generation (e.g., `sms-voice` was removed in builder v8.11.0). Be aware of potential service availability changes when upgrading major `boto3` or `mypy-boto3` versions.","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"}