{"id":3150,"library":"mypy-boto3-sso","title":"mypy-boto3-sso Type Stubs for AWS SSO Service","description":"mypy-boto3-sso provides type annotations for the AWS Single Sign-On (SSO) service client in `boto3`. It enhances development with static type checking for `boto3` resources, clients, and responses, catching potential errors at development time. The current version is 1.42.3, and it follows a frequent release cadence, often aligning with `boto3`/`botocore` updates and `mypy-boto3-builder` releases.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","sso","types","mypy","type-stubs","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-sso","lang":"bash","label":"Install mypy-boto3-sso"}],"dependencies":[{"reason":"This package provides type stubs for boto3, which must be installed separately to use the AWS SDK functionality.","package":"boto3","optional":false},{"reason":"Requires Python 3.9 or newer.","package":"python","optional":false}],"imports":[{"note":"Used for explicit type hinting of the SSO client object.","symbol":"SSOClient","correct":"from mypy_boto3_sso.client import SSOClient"},{"note":"Used for explicit type hinting of specific SSO service response objects.","symbol":"GetRoleCredentialsResponseTypeDef","correct":"from mypy_boto3_sso.type_defs import GetRoleCredentialsResponseTypeDef"}],"quickstart":{"code":"import boto3\nimport os\nfrom mypy_boto3_sso.client import SSOClient\nfrom mypy_boto3_sso.type_defs import GetRoleCredentialsResponseTypeDef\n\n# Ensure boto3 is installed and configured (e.g., via AWS CLI or env vars)\n# You might need to set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION\n# or use SSO login methods. For this example, we assume SSO token is available.\n\n# Explicitly type the SSO client\nsso_client: SSOClient = boto3.client(\"sso\", region_name=\"us-east-1\")\n\n# Replace with your actual SSO details\nROLE_NAME = os.environ.get(\"SSO_ROLE_NAME\", \"YourSSORole\")\nACCOUNT_ID = os.environ.get(\"SSO_ACCOUNT_ID\", \"123456789012\")\nACCESS_TOKEN = os.environ.get(\"SSO_ACCESS_TOKEN\", \"your_sso_access_token_here\") # Typically obtained from AWS CLI sso login\n\ntry:\n    # Call a method and type hint its response\n    response: GetRoleCredentialsResponseTypeDef = sso_client.get_role_credentials(\n        roleName=ROLE_NAME,\n        accountId=ACCOUNT_ID,\n        accessToken=ACCESS_TOKEN\n    )\n\n    print(f\"Successfully retrieved role credentials for {ROLE_NAME} in account {ACCOUNT_ID}:\")\n    print(f\"  Access Key ID: {response['roleCredentials']['accessKeyId']}\")\n    # Note: sensitive information like secretKey and sessionToken should be handled securely\n    # print(f\"  Secret Key: {response['roleCredentials']['secretAccessKey']}\")\n    # print(f\"  Session Token: {response['roleCredentials']['sessionToken']}\")\n    print(f\"  Expiration: {response['roleCredentials']['expirationDate']}\")\n\nexcept sso_client.exceptions.InvalidRequestException as e:\n    print(f\"Error: Invalid request - {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-sso` to type-hint your AWS SSO client and its method responses. It uses environment variables for sensitive data to make the example runnable without hardcoding credentials. Remember to install `boto3` alongside `mypy-boto3-sso`."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin an older version of `mypy-boto3-sso` (e.g., `mypy-boto3-sso<1.42.3`).","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates `mypy-boto3-sso` and other service packages), support for Python 3.8 was removed. This means `mypy-boto3-sso` versions generated by builder 8.12.0 or later (including the current 1.42.3) require Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-sso >= 1.42.3 (aligned with mypy-boto3-builder >= 8.12.0)"},{"fix":"Ensure `boto3` is installed in your project: `pip install boto3`.","message":"`mypy-boto3-sso` provides only type stubs; it does not include the `boto3` library itself. You must install `boto3` separately for your application to function.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Align your `mypy-boto3-sso` and `boto3` package versions. For example, if you use `boto3==1.28.0`, install `mypy-boto3-sso==1.28.0`.","message":"For optimal type checking, the version of `mypy-boto3-sso` should ideally match the version of `boto3` you are using. Significant mismatches can lead to incorrect type hints or undetected issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Most users will not be affected. If you encounter packaging-related issues, consult the `mypy-boto3-builder` documentation or ensure your tooling supports modern PEP 561 package distributions.","message":"The `mypy-boto3-builder` (which generates this package) migrated to PEP 561-compliant packaging in version 8.12.0. While largely internal, this change might affect specific build systems or tools that interact directly with Python packaging metadata, potentially requiring updates to those systems.","severity":"gotcha","affected_versions":"mypy-boto3-sso >= 1.42.3 (aligned with mypy-boto3-builder >= 8.12.0)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}