{"id":3566,"library":"mypy-boto3-codeguru-security","title":"mypy-boto3-codeguru-security","description":"mypy-boto3-codeguru-security provides type annotations for the `boto3` AWS SDK for Python, specifically for the CodeGuruSecurity service. These stubs enable static type checkers like Mypy to validate `boto3` calls, improving code quality and catching errors early. It is part of the `mypy-boto3-builder` ecosystem, which maintains a regular release cadence to stay in sync with `boto3` updates. The current version is 1.42.3.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","stubs","codeguru-security","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-codeguru-security boto3","lang":"bash","label":"Install library and boto3"},{"cmd":"pip install mypy","lang":"bash","label":"Install Mypy (if not already)"}],"dependencies":[{"reason":"This package provides type stubs for boto3's CodeGuruSecurity service. boto3 itself is a runtime dependency for using the AWS SDK.","package":"boto3","optional":false},{"reason":"This package is designed to be consumed by static type checkers like Mypy to provide type safety for boto3 operations.","package":"mypy","optional":true}],"imports":[{"note":"Import the specific client type for explicit type hinting of the boto3 client object.","symbol":"CodeGuruSecurityClient","correct":"from mypy_boto3_codeguru_security.client import CodeGuruSecurityClient"},{"note":"Import specific TypedDicts for precise type hinting of API responses or request parameters. These are nested under `type_defs`.","symbol":"ListFindingsResponseTypeDef","correct":"from mypy_boto3_codeguru_security.type_defs import ListFindingsResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_codeguru_security.client import CodeGuruSecurityClient\nfrom mypy_boto3_codeguru_security.type_defs import ListFindingsResponseTypeDef\n\ndef get_codeguru_security_client() -> CodeGuruSecurityClient:\n    \"\"\"Initializes and returns a CodeGuruSecurity client with type hints.\"\"\"\n    # boto3 automatically picks up credentials from environment variables or IAM roles\n    # For local testing, ensure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN (optional) are set.\n    return boto3.client(\"codeguru-security\")\n\ndef list_all_findings(client: CodeGuruSecurityClient) -> None:\n    \"\"\"Lists CodeGuruSecurity findings and prints their IDs.\"\"\"\n    print(\"Listing CodeGuruSecurity findings...\")\n    paginator = client.get_paginator(\"list_findings\")\n    page_iterator = paginator.paginate()\n\n    found_findings = 0\n    for page in page_iterator:\n        page_data: ListFindingsResponseTypeDef = page\n        for finding in page_data.get(\"findings\", []):\n            print(f\"  Finding ID: {finding.get('id')}\")\n            found_findings += 1\n    if found_findings == 0:\n        print(\"  No findings found.\")\n    else:\n        print(f\"Found {found_findings} findings.\")\n\nif __name__ == \"__main__\":\n    # Example usage\n    codeguru_client = get_codeguru_security_client()\n    list_all_findings(codeguru_client)\n","lang":"python","description":"This example demonstrates how to create a `boto3` client for CodeGuruSecurity with explicit type hints and then use it to list findings, leveraging paginators. To run this, ensure `boto3` and `mypy-boto3-codeguru-security` are installed, and your AWS credentials are configured (e.g., via environment variables or AWS CLI configuration)."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"The `mypy-boto3-builder` (which generates this stub package) dropped support for Python 3.8 in version 8.12.0. All generated stub packages now require Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (affecting mypy-boto3-codeguru-security >= 1.42.0)"},{"fix":"Ensure `boto3` is included in your project's dependencies and installed (e.g., `pip install boto3 mypy-boto3-codeguru-security`).","message":"This package provides only type stubs and does not install `boto3` itself. You must explicitly install `boto3` alongside this stub package for your application to function at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your imports of specific `TypeDef` classes and update their names according to the new conventions (e.g., look for removed `Request` suffixes or shifted `Extra` postfixes).","message":"For advanced users who directly import `TypeDef` objects, `mypy-boto3-builder` version 8.9.0 introduced breaking changes to TypeDef naming conventions (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (affecting mypy-boto3-codeguru-security >= 1.39.0)"},{"fix":"Always refer to the official `mypy-boto3` documentation or `boto3` documentation for the latest service names and corresponding stub package names if you encounter import errors for specific services.","message":"AWS service names can occasionally change or be deprecated (e.g., 'sms-voice' to 'pinpoint-sms-voice' in older builder versions). While 'codeguru-security' is stable, be aware that the specific stub package you need might change if the underlying AWS service name evolves.","severity":"gotcha","affected_versions":"All versions (potential for future changes)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}