{"id":2599,"library":"mypy-boto3-cognito-idp","title":"mypy-boto3-cognito-idp","description":"mypy-boto3-cognito-idp provides comprehensive type annotations for the `boto3` library's Cognito Identity Provider service. It enables static type checking with tools like mypy and pyright, offering enhanced auto-completion and early error detection in IDEs for `boto3` calls related to Cognito IDP. The library, currently at version 1.42.59, is auto-generated by `mypy-boto3-builder` and frequently updated to synchronize with `boto3` releases, ensuring up-to-date and accurate type definitions.","status":"active","version":"1.42.59","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","mypy","type-hints","cognito","cognito-idp","stubs"],"install":[{"cmd":"pip install mypy-boto3-cognito-idp","lang":"bash","label":"Standalone package"},{"cmd":"pip install 'boto3-stubs[cognito-idp]'","lang":"bash","label":"As part of boto3-stubs"}],"dependencies":[{"reason":"Provides the actual AWS SDK for Python functionality; mypy-boto3-cognito-idp only provides type stubs.","package":"boto3","optional":false},{"reason":"Requires Python 3.9 or newer. Support for Python 3.8 was removed in mypy-boto3-builder 8.12.0.","package":"python","optional":false},{"reason":"May be required for advanced type features, especially with older Python 3.9 versions, though typically managed by the builder's dependencies.","package":"typing-extensions","optional":true}],"imports":[{"note":"The type stub class is imported directly from the mypy_boto3_cognito_idp package, not from boto3 itself.","wrong":"from boto3.client import CognitoIdentityProviderClient","symbol":"CognitoIdentityProviderClient","correct":"from mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient"}],"quickstart":{"code":"import boto3\nfrom boto3.session import Session\nfrom mypy_boto3_cognito_idp.client import CognitoIdentityProviderClient\n\n\ndef get_cognito_idp_client(region_name: str = 'us-east-1') -> CognitoIdentityProviderClient:\n    \"\"\"Returns a type-hinted CognitoIdentityProvider client.\"\"\"\n    # Actual boto3 client (runtime)\n    session: Session = boto3.session.Session()\n    client: CognitoIdentityProviderClient = session.client(\n        \"cognito-idp\", \n        region_name=region_name,\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    return client\n\n# Example usage\nif __name__ == \"__main__\":\n    import os\n    os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')\n    os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')\n\n    cognito_client = get_cognito_idp_client()\n    # You now have auto-completion and type checking for cognito_client methods\n    # For example, cognito_client.list_user_pools() will show correct types.\n    # response = cognito_client.list_user_pools(MaxResults=10)\n    print(f\"Client type: {type(cognito_client)}\")\n    # This client object now benefits from mypy-boto3 type hints.\n","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted `CognitoIdentityProviderClient` using `boto3.session.Session().client()` with explicit type annotations for static analysis. This pattern allows IDEs and type checkers to provide full autocompletion and validation for Cognito IDP service methods and their parameters."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher. If unable to upgrade, pin `mypy-boto3-cognito-idp` to an older compatible version (e.g., <1.42.59).","message":"Python 3.8 support was removed in `mypy-boto3-builder` version 8.12.0 and subsequent generated packages. Users on Python 3.8 will encounter issues and must upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (which generates mypy-boto3-cognito-idp 1.42.59+)"},{"fix":"Ensure your type checker (e.g., mypy, pyright) is updated to a recent version that fully supports PEP 561. Reinstalling stub packages might resolve discovery issues.","message":"Migration to PEP 561 compliant packages in `mypy-boto3-builder` 8.12.0 might affect how type checkers discover stubs. While typically seamless, ensure your type checker configuration is up-to-date.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder"},{"fix":"Always ensure `boto3` is installed alongside `mypy-boto3-cognito-idp` (e.g., `pip install boto3 mypy-boto3-cognito-idp`).","message":"The `mypy-boto3-cognito-idp` package provides *only* type stubs. The actual `boto3` library must be installed separately in your environment for the code to run.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install `mypy-boto3-cognito-idp` with a version that matches your `boto3` installation (e.g., if `boto3==1.42.59`, use `mypy-boto3-cognito-idp==1.42.59`). Consider using `boto3-stubs[boto3]` for automatic version synchronization.","message":"Mismatching versions between your installed `boto3` library and `mypy-boto3-cognito-idp` can lead to inaccurate or missing type hints. `mypy-boto3` packages are versioned to match corresponding `boto3` versions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review any explicit TypeDef imports or usage in your codebase, especially for request/response structures. Update to the new naming conventions as suggested by your type checker.","message":"In `mypy-boto3-builder` 8.9.0, there were breaking changes to TypeDef naming conventions, including using shorter names for packed method arguments (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving the `Extra` postfix for conflicting TypeDefs.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder"},{"fix":"If experiencing performance issues in PyCharm, install `boto3-stubs-lite[cognito-idp]` instead (if explicit type annotations are acceptable) or configure PyCharm to use an external type checker like `mypy` or `pyright`.","message":"PyCharm users may experience slow performance or high CPU usage due to how PyCharm handles Literal overloads. `boto3-stubs-lite` or disabling PyCharm's type checker in favor of `mypy` or `pyright` is recommended.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}