{"id":3058,"library":"mypy-boto3-cognito-identity","title":"mypy-boto3-cognito-identity Type Stubs","description":"This library provides PEP 561 compliant type annotations (stubs) for the `boto3` client for AWS CognitoIdentity service. It enhances type checking for `boto3` calls, improving code reliability and developer experience. Maintained by the `mypy-boto3-builder` project, it releases frequently, often in sync with new `boto3` service definitions or `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":["boto3","aws","mypy","type-hints","stubs","cognito-identity"],"install":[{"cmd":"pip install mypy-boto3-cognito-identity","lang":"bash","label":"Install Type Stubs"}],"dependencies":[{"reason":"These are type stubs for boto3; boto3 must be installed for runtime functionality.","package":"boto3","optional":false}],"imports":[{"symbol":"CognitoIdentityClient","correct":"from mypy_boto3_cognito_identity.client import CognitoIdentityClient"},{"note":"For paginated operations, import specific paginator types.","symbol":"ListIdentitiesPaginator","correct":"from mypy_boto3_cognito_identity.paginator import ListIdentitiesPaginator"},{"note":"Import specific TypeDef for request/response bodies.","symbol":"GetIdResponseTypeDef","correct":"from mypy_boto3_cognito_identity.type_defs import GetIdResponseTypeDef"}],"quickstart":{"code":"import boto3\nimport os\nfrom mypy_boto3_cognito_identity.client import CognitoIdentityClient\nfrom mypy_boto3_cognito_identity.type_defs import GetIdResponseTypeDef\n\n# Instantiate a boto3 client for CognitoIdentity, type-hinted by the stubs\n# In a real application, credentials would be managed via IAM roles or environment variables.\nclient: CognitoIdentityClient = boto3.client(\n    \"cognito-identity\",\n    region_name=\"us-east-1\", # Replace with your AWS region\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)\n\n# Example: Get an identity ID (replace with actual AccountId and IdentityPoolId)\n# Note: This operation creates an identity if it doesn't exist for the given pool.\ntry:\n    response: GetIdResponseTypeDef = client.get_id(\n        AccountId=\"123456789012\",  # Replace with a valid AWS Account ID\n        IdentityPoolId=\"us-east-1:abcdefgh-abcd-abcd-abcd-abcdefghijkl\" # Replace with a valid Identity Pool ID\n    )\n\n    identity_id = response.get('IdentityId')\n    print(f\"Successfully retrieved Identity ID: {identity_id}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n\n# Mypy will now correctly validate argument types and response structure.","lang":"python","description":"This example demonstrates how to initialize a `boto3` CognitoIdentity client with type hinting from `mypy-boto3-cognito-identity` and perform a basic operation (`get_id`). Ensure `boto3` is also installed. Type checking will catch incorrect arguments or attribute access on the `response` object."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 is no longer supported. Packages built with `mypy-boto3-builder` 8.12.0+ (including this version) require Python 3.9 or newer.","severity":"breaking","affected_versions":"1.42.3+"},{"fix":"Ensure `mypy` is up-to-date. Recreate your virtual environment if stub paths seem incorrect or `mypy` fails to find types.","message":"Migration to PEP 561 packaging (namespace packages). While generally transparent, this change might require updating your `mypy` version or refreshing your virtual environment if you encounter issues with stub discovery.","severity":"breaking","affected_versions":"1.42.3+"},{"fix":"Ensure both `pip install boto3` and `pip install mypy-boto3-cognito-identity` are executed.","message":"This package provides *only* type stubs. You must separately install the `boto3` library for actual runtime functionality. `mypy-boto3-cognito-identity` does not replace `boto3`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review and update any custom `TypeDef` references or aliases in your codebase to match the new shorter names.","message":"TypeDef naming conventions changed for packed method arguments, potentially breaking existing type hints if custom TypeDefs were manually defined or referenced. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.","severity":"breaking","affected_versions":"Versions generated by `mypy-boto3-builder` 8.9.0 and newer (e.g., this package version 1.42.3)."},{"fix":"Check `mypy-boto3-builder` release notes for changes affecting specific services. Update package names or imports as required.","message":"Service support within the `mypy-boto3` ecosystem can change. Services might be deprecated, renamed (e.g., `sms-voice` to `pinpoint-sms-voice`), or excluded from builds, potentially breaking imports for other `mypy-boto3-*` packages.","severity":"gotcha","affected_versions":"All versions (ecosystem-wide)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}