{"id":3161,"library":"mypy-boto3-trustedadvisor","title":"mypy-boto3-trustedadvisor Type Stubs","description":"mypy-boto3-trustedadvisor provides type annotations for the boto3 TrustedAdvisorPublicAPI service, ensuring static type checking and improved IDE autocomplete for AWS Trusted Advisor operations. It is generated by the mypy-boto3-builder, which frequently releases updates to keep pace with new boto3 versions and service changes, often on a weekly or bi-weekly cadence.","status":"active","version":"1.42.54","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","types","stubs","trustedadvisor","type-hinting","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-trustedadvisor","lang":"bash","label":"Direct installation"},{"cmd":"pip install 'boto3-stubs[trustedadvisor]'","lang":"bash","label":"Installation via boto3-stubs extras"}],"dependencies":[{"reason":"Runtime dependency for AWS API calls; these are type stubs for boto3.","package":"boto3","optional":false},{"reason":"Used by the generated stubs for compatibility with Python versions older than 3.9, though the package itself requires >=3.9.","package":"typing-extensions","optional":true}],"imports":[{"note":"The type stub client is imported from the mypy_boto3_trustedadvisor package, not directly from boto3.","wrong":"from boto3.client import TrustedAdvisorPublicAPIClient","symbol":"TrustedAdvisorPublicAPIClient","correct":"from mypy_boto3_trustedadvisor.client import TrustedAdvisorPublicAPIClient"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_trustedadvisor.client import TrustedAdvisorPublicAPIClient\nfrom mypy_boto3_trustedadvisor.type_defs import DescribeAccountRecommendationsResponseTypeDef\n\ndef get_trustedadvisor_client() -> TrustedAdvisorPublicAPIClient:\n    # Assuming AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)\n    session = boto3.session.Session()\n    client: TrustedAdvisorPublicAPIClient = session.client('trustedadvisor')\n    return client\n\nif __name__ == '__main__':\n    trustedadvisor_client = get_trustedadvisor_client()\n    # Example API call with type hints\n    response: DescribeAccountRecommendationsResponseTypeDef = trustedadvisor_client.describe_account_recommendations()\n    print(response)","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted TrustedAdvisorPublicAPIClient using boto3 and the mypy-boto3-trustedadvisor stubs. It shows explicit type annotation for the client and a response TypeDef for improved type checking and auto-completion."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later.","message":"Support for Python 3.8 was removed in mypy-boto3-builder version 8.12.0, which generated this stub. Users on Python 3.8 will need to upgrade their Python version to 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (which corresponds to mypy-boto3-trustedadvisor >=1.42.54)"},{"fix":"Ensure your type checker (e.g., mypy) and IDE are updated to support PEP 561 standards, and clean any old type stub caches.","message":"The mypy-boto3-builder migrated to PEP 561 compliant packages in version 8.12.0. This change affects how type checkers resolve modules and might require updates to mypy configuration or development environment setups, especially when mixing older and newer stub versions.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (which corresponds to mypy-boto3-trustedadvisor >=1.42.54)"},{"fix":"Review and update `TypeDef` import paths and names in your codebase according to the new conventions.","message":"Beginning with mypy-boto3-builder 8.9.0, TypeDef naming conventions were changed. Arguments like `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `Extra` postfixes moved (`CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`). This affects all generated service stubs, including Trusted Advisor.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder"},{"fix":"Consider `pip install 'boto3-stubs-lite[trustedadvisor]'` or adjust PyCharm's type checking settings.","message":"PyCharm might experience slow performance with Literal overloads when using boto3-stubs. It is recommended to use `boto3-stubs-lite` if performance issues are encountered. Alternatively, disable PyCharm's internal type checker and rely on external tools like mypy or pyright.","severity":"gotcha","affected_versions":"All versions, specifically impacting PyCharm users"},{"fix":"Always explicitly annotate `client: TrustedAdvisorPublicAPIClient = session.client('trustedadvisor')`.","message":"For standalone packages like `mypy-boto3-trustedadvisor`, explicit type annotations are often required for `boto3.client` calls to leverage the type stubs effectively. Automatic type discovery may not work without the full `boto3-stubs` umbrella package.","severity":"gotcha","affected_versions":"All versions when using standalone packages"},{"fix":"Stay updated with boto3 and mypy-boto3-builder release notes to catch any service renaming or deprecation affecting stub packages.","message":"Service names within the AWS ecosystem can be renamed or deprecated (e.g., `sms-voice` to `pinpoint-sms-voice` in older releases of mypy-boto3-builder). While not specific to TrustedAdvisor, this pattern means users should be aware that the corresponding stub package name might change in the future if AWS renames the service.","severity":"gotcha","affected_versions":"All versions, as a general ecosystem pattern"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}