{"id":24763,"library":"types-boto3-cognito-idp","title":"types-boto3-cognito-idp","description":"Type annotations for boto3 CognitoIdentityProvider service. Provides static typing stubs for Amazon Cognito User Pools (IDP). Generated by mypy-boto3-builder. Version 1.43.0 requires Python >=3.9. Active development.","status":"active","version":"1.43.0","language":"python","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","cognito-idp","type-stubs","typing","aws","mypy"],"install":[{"cmd":"pip install types-boto3-cognito-idp","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Runtime dependency; stubs annotate boto3 service client","package":"boto3","optional":true},{"reason":"Required for Python <3.11 for NotRequired and other PEP 604 features","package":"typing-extensions","optional":true}],"imports":[{"note":"Do not use plain Any; use the generated client type","wrong":"from typing import Any","symbol":"CognitoIdentityProviderClient","correct":"from mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient"},{"note":"TypeDefs are in the type_defs module; do not attempt to import from boto3","wrong":"from boto3 import Session","symbol":"AdminGetUserResponseTypeDef","correct":"from mypy_boto3_cognito_idp.type_defs import AdminGetUserResponseTypeDef"},{"note":"","wrong":"","symbol":"ListUsersPaginator","correct":"from mypy_boto3_cognito_idp.paginator import ListUsersPaginator"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient\nfrom mypy_boto3_cognito_idp.type_defs import AdminGetUserResponseTypeDef\n\ndef get_user_email(client: CognitoIdentityProviderClient, user_pool_id: str, username: str) -> str:\n    response: AdminGetUserResponseTypeDef = client.admin_get_user(\n        UserPoolId=user_pool_id,\n        Username=username\n    )\n    for attr in response.get('UserAttributes', []):\n        if attr['Name'] == 'email':\n            return attr['Value']\n    return ''\n\nclient: CognitoIdentityProviderClient = boto3.client('cognito-idp')\nemail = get_user_email(client, os.environ.get('USER_POOL_ID', ''), os.environ.get('USERNAME', ''))\nprint(email)","lang":"python","description":"Type-annotated usage of CognitoIdentityProviderClient and AdminGetUserResponseTypeDef"},"warnings":[{"fix":"Use 'from mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient'","message":"Do NOT import 'CognitoIdentityProviderClient' directly from 'boto3'. The boto3 package does not export it; you must import from 'mypy_boto3_cognito_idp.client'. Without this, static type checkers (mypy, pyright) will not recognise the type.","severity":"gotcha","affected_versions":"all"},{"fix":"Rename imports: remove duplicate 'Request' in TypeDef names. For version-specific TypeDefs, check the generated stubs.","message":"Version 8.9.0 of mypy-boto3-builder renamed many TypeDefs by dropping redundant 'Request' suffixes (breaking change). For example, 'AdminGetUserRequestRequestTypeDef' became 'AdminGetUserRequestTypeDef'. If you pinned to an older types-boto3-cognito-idp, you may need to update your typings.","severity":"breaking","affected_versions":">=1.34.0 (generated by builder 8.9.0+)"},{"fix":"Use 'from mypy_boto3_cognito_idp.paginator import ListUsersPaginator' for paginator types, and 'from mypy_boto3_cognito_idp.type_defs import ...' for service response/request types.","message":"TypeDefs for paginators (e.g., ListUsersPaginator) require importing from the paginator submodule, not from type_defs. Using the wrong module will cause mypy errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to Python 3.9+ or pin to an older version of the stubs (e.g., 1.34.0) if you still need 3.8.","message":"Python 3.8 support was removed in builder version 8.12.0. types-boto3-cognito-idp requires Python >=3.9.","severity":"deprecated","affected_versions":">=1.43.0"},{"fix":"Install the correct package: 'pip install types-aioboto3-cognito-idp' if you use aioboto3.","message":"The package name 'types-boto3-cognito-idp' is used for Boto3 v1 stubs. For aioboto3, use 'types-aioboto3-cognito-idp' instead. Mixing them leads to missing stubs.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install types-boto3-cognito-idp' and ensure mypy is configured to use the stubs (e.g., 'mypy --namespace-packages ...').","cause":"The package is not installed or not being picked up by mypy.","error":"Cannot find implementation or library stub for module 'mypy_boto3_cognito_idp'"},{"fix":"Use 'from mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient'.","cause":"Trying to import 'CognitoIdentityProviderClient' from the top-level mypy_boto3_cognito_idp package, but it is located in the 'client' submodule.","error":"Module 'mypy_boto3_cognito_idp' has no attribute 'CognitoIdentityProviderClient'"},{"fix":"Add 'from mypy_boto3_cognito_idp.type_defs import AdminGetUserResponseTypeDef'.","cause":"Forgot to import the TypeDef, or imported from the wrong module (e.g., from the paginator module instead of type_defs).","error":"Name 'AdminGetUserResponseTypeDef' is not defined"},{"fix":"Upgrade to Python 3.9+ and use 'from __future__ import annotations' at the top of your file, or use typing.Optional/X | None correctly.","cause":"Using Python 3.8 with newer stubs that require 3.9+. The stubs use PEP 604 union syntax (X | None) which is only supported at runtime in Python 3.10+ and with __future__ annotations.","error":"\"Optional\" is not subscriptable / \"Type\" is not generic"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}