Install & Compatibility
Where this runs
tested against v1.43.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SSOClient
✓ from mypy_boto3_sso.client import SSOClient
✗ from mypy_boto3_sso import SSOClient
SSOServiceResource
✓ from mypy_boto3_sso import SSOServiceResource
ServiceResource
✓ from mypy_boto3_sso.service_resource import ServiceResource
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`.
import boto3
import os
from mypy_boto3_sso.client import SSOClient
from mypy_boto3_sso.type_defs import GetRoleCredentialsResponseTypeDef
# Ensure boto3 is installed and configured (e.g., via AWS CLI or env vars)
# You might need to set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
# or use SSO login methods. For this example, we assume SSO token is available.
# Explicitly type the SSO client
sso_client: SSOClient = boto3.client("sso", region_name="us-east-1")
# Replace with your actual SSO details
ROLE_NAME = os.environ.get("SSO_ROLE_NAME", "YourSSORole")
ACCOUNT_ID = os.environ.get("SSO_ACCOUNT_ID", "123456789012")
ACCESS_TOKEN = os.environ.get("SSO_ACCESS_TOKEN", "your_sso_access_token_here") # Typically obtained from AWS CLI sso login
try:
# Call a method and type hint its response
response: GetRoleCredentialsResponseTypeDef = sso_client.get_role_credentials(
roleName=ROLE_NAME,
accountId=ACCOUNT_ID,
accessToken=ACCESS_TOKEN
)
print(f"Successfully retrieved role credentials for {ROLE_NAME} in account {ACCOUNT_ID}:")
print(f" Access Key ID: {response['roleCredentials']['accessKeyId']}")
# Note: sensitive information like secretKey and sessionToken should be handled securely
# print(f" Secret Key: {response['roleCredentials']['secretAccessKey']}")
# print(f" Session Token: {response['roleCredentials']['sessionToken']}")
print(f" Expiration: {response['roleCredentials']['expirationDate']}")
except sso_client.exceptions.InvalidRequestException as e:
print(f"Error: Invalid request - {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingStarting 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.fixUpgrade 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`).
affects: mypy-boto3-sso >= 1.42.3 (aligned with mypy-boto3-builder >= 8.12.0)
gotcha`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.fixEnsure `boto3` is installed in your project: `pip install boto3`.
affects: All versions
gotchaFor 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.fixAlign your `mypy-boto3-sso` and `boto3` package versions. For example, if you use `boto3==1.28.0`, install `mypy-boto3-sso==1.28.0`.
affects: All versions
gotchaThe `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.fixMost 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.
affects: mypy-boto3-sso >= 1.42.3 (aligned with mypy-boto3-builder >= 8.12.0)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for boto3, which must be installed separately to use the AWS SDK functionality.
pythonrequiredRequires Python 3.9 or newer.