{"id":3053,"library":"mypy-boto3-codeguru-reviewer","title":"Type Annotations for boto3 CodeGuru Reviewer","description":"mypy-boto3-codeguru-reviewer provides type annotations for the boto3 AWS SDK, specifically for the CodeGuru Reviewer service. It enhances static type checking with tools like mypy, improves IDE autocomplete, and helps catch potential bugs at development time. The library is currently at version 1.42.3 and is actively maintained with frequent updates following boto3 releases.","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-hinting","CodeGuruReviewer","stubs"],"install":[{"cmd":"pip install boto3 mypy mypy-boto3-codeguru-reviewer","lang":"bash","label":"Install with boto3 and mypy"}],"dependencies":[{"reason":"Provides the AWS SDK functionality that this library adds type hints for.","package":"boto3"},{"reason":"Static type checker that utilizes these annotations.","package":"mypy"}],"imports":[{"note":"Use this for type-hinting the boto3 CodeGuru Reviewer client instance.","symbol":"CodeGuruReviewerClient","correct":"from mypy_boto3_codeguru_reviewer.client import CodeGuruReviewerClient"},{"note":"Import specific TypeDefs for precise type-hinting of API call responses. Other TypeDefs are available for various service operations.","symbol":"ListRepositoryAssociationsResponseTypeDef","correct":"from mypy_boto3_codeguru_reviewer.type_defs import ListRepositoryAssociationsResponseTypeDef"},{"note":"Useful when using overloads for boto3.client directly, though explicit client imports are often preferred.","symbol":"CodeGuruReviewerServiceName","correct":"from mypy_boto3_codeguru_reviewer.literals import CodeGuruReviewerServiceName"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_codeguru_reviewer.client import CodeGuruReviewerClient\nfrom mypy_boto3_codeguru_reviewer.type_defs import ListRepositoryAssociationsResponseTypeDef\nimport os\n\ndef get_reviewer_client() -> CodeGuruReviewerClient:\n    \"\"\"Returns a type-hinted CodeGuruReviewer client.\"\"\"\n    # Ensure AWS_REGION is set in environment or configure it explicitly\n    return boto3.client(\"codeguru-reviewer\", region_name=os.environ.get(\"AWS_REGION\", \"us-east-1\"))\n\ndef list_reviewer_associations() -> ListRepositoryAssociationsResponseTypeDef:\n    \"\"\"Lists CodeGuru Reviewer repository associations with type hints.\"\"\"\n    client: CodeGuruReviewerClient = get_reviewer_client()\n    response: ListRepositoryAssociationsResponseTypeDef = client.list_repository_associations()\n    print(\"CodeGuru Reviewer Repository Associations:\")\n    for association in response.get(\"RepositoryAssociationSummaries\", []):\n        print(f\"- {association.get('Name')} (State: {association.get('State')})\")\n    return response\n\nif __name__ == \"__main__\":\n    # Set dummy environment variables if not already set, for demonstration purposes.\n    # In a real scenario, use proper AWS credential configuration.\n    if not os.environ.get(\"AWS_ACCESS_KEY_ID\"):\n        os.environ[\"AWS_ACCESS_KEY_ID\"] = \"TEST_KEY\"\n    if not os.environ.get(\"AWS_SECRET_ACCESS_KEY\"):\n        os.environ[\"AWS_SECRET_ACCESS_KEY\"] = \"TEST_SECRET\"\n    if not os.environ.get(\"AWS_REGION\"):\n        os.environ[\"AWS_REGION\"] = \"us-east-1\"\n\n    try:\n        list_reviewer_associations()\n    except Exception as e:\n        # Boto3 client operations will fail if credentials are not valid,\n        # but mypy type checking will still work. \n        print(f\"An error occurred during runtime: {e}\")\n        print(\"Please ensure your AWS credentials and region are configured correctly for actual execution.\")","lang":"python","description":"This quickstart demonstrates how to initialize a type-hinted CodeGuruReviewer client and call a basic operation, `list_repository_associations`, with its response also fully type-hinted. Ensure `boto3` and `mypy` are installed alongside this stub package. For actual execution, valid AWS credentials and region must be configured."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 3.8 support was removed starting with `mypy-boto3-builder` version 8.12.0. `mypy-boto3-codeguru-reviewer` versions aligning with this builder version (1.42.3 and newer) will only support Python 3.9 and higher. Users on Python 3.8 must upgrade their Python environment.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0 (equivalent mypy-boto3-codeguru-reviewer versions >=1.42.3)"},{"fix":"Update your TypeDef import paths and names to align with the new conventions by checking the generated `type_defs.pyi` for the service or the `mypy-boto3` documentation.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. This can lead to shorter names for method argument TypeDefs (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and postfix changes for conflicting names. Existing type hints in your code that reference older TypeDef names may break.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Ensure both `boto3` and `mypy-boto3-codeguru-reviewer` are installed in your project's environment. Run `mypy` from an environment where these packages are accessible.","message":"This library is a PEP 561-compliant stub-only package. It provides type information for `boto3`, but `boto3` itself must still be installed separately for the code to run. For `mypy` to properly find and utilize these type stubs, `mypy-boto3-codeguru-reviewer` (or the overarching `boto3-stubs` package) must be installed in the Python environment where `mypy` is executed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always add explicit type annotations for `boto3` clients and resources, such as `client: CodeGuruReviewerClient = boto3.client(\"codeguru-reviewer\")`.","message":"While `mypy-boto3-stubs` (the umbrella package) can offer some auto-discovery for `boto3.client` calls, for the most robust type checking, consistent autocomplete in IDEs, and clear code, it is generally recommended to explicitly type-hint your `boto3` client objects using imports like `from mypy_boto3_codeguru_reviewer.client import CodeGuruReviewerClient`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}