{"id":3051,"library":"mypy-boto3-codecommit","title":"mypy-boto3-codecommit","description":"mypy-boto3-codecommit provides type annotations for the boto3 CodeCommit service, enabling static type checking with mypy. It's automatically generated from AWS service definitions, ensuring up-to-date and accurate type hints. The current version is 1.42.3, with releases closely tracking boto3 and mypy-boto3-builder updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","mypy","type-hints","stubs","codecommit","aws-sdk"],"install":[{"cmd":"pip install boto3 mypy mypy-boto3-codecommit","lang":"bash","label":"Install core libraries and type stubs"}],"dependencies":[{"reason":"Runtime dependency for AWS SDK functionality, without which the stubs are useless.","package":"boto3"},{"reason":"Development dependency for static type checking, the primary purpose of this library.","package":"mypy"}],"imports":[{"note":"Type stubs are provided by mypy_boto3_codecommit, not directly from boto3.","wrong":"from boto3.client import CodeCommitClient","symbol":"CodeCommitClient","correct":"from mypy_boto3_codecommit.client import CodeCommitClient"},{"note":"Use this for the service resource type, if needed.","symbol":"CodeCommitServiceResource","correct":"from mypy_boto3_codecommit.service_resource import CodeCommitServiceResource"}],"quickstart":{"code":"import os\nimport boto3\nfrom mypy_boto3_codecommit.client import CodeCommitClient\nfrom botocore.exceptions import ClientError\n\n# Ensure AWS_REGION is set in environment variables or provide region_name directly\nregion = os.environ.get(\"AWS_REGION\", \"us-east-1\")\n\ntry:\n    # Initialize a typed CodeCommit client\n    client: CodeCommitClient = boto3.client(\"codecommit\", region_name=region)\n    print(f\"Listing repositories in region: {region}...\")\n    \n    # Use a client method with type hints\n    response = client.list_repositories(\n        sortBy=\"repositoryName\",\n        order=\"ascending\"\n    )\n    \n    repositories = response.get(\"repositories\", [])\n    if repositories:\n        print(f\"Found {len(repositories)} repositories:\")\n        for repo in repositories[:3]: # Limit output for brevity\n            print(f\"- {repo['repositoryName']} (ID: {repo['repositoryId']})\")\n    else:\n        print(\"No repositories found.\")\n        \nexcept ClientError as e:\n    print(f\"AWS Client Error: {e}\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\n\n# To verify types, save this code as `app.py` and run:\n# mypy app.py","lang":"python","description":"This quickstart demonstrates how to initialize a type-hinted boto3 CodeCommit client and use one of its methods. Running `mypy app.py` against this script will leverage the installed type stubs to check for type correctness, enhancing development reliability."},"warnings":[{"fix":"Upgrade to Python 3.9+ or pin `mypy-boto3-codecommit` to a version compatible with Python 3.8 (e.g., `<1.42.0`).","message":"Python 3.8 support was removed for all mypy-boto3 packages from builder version 8.12.0 onwards. If you are using an older Python version, you must pin your mypy-boto3-* packages to an earlier version.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (affecting mypy-boto3-codecommit ~1.42.0+)"},{"fix":"Update your import paths and references to the new `TypeDef` names. Consult the `mypy-boto3` documentation or regenerate your local stubs to find the correct names.","message":"TypeDef names for method arguments and conflicting names were refactored (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`, `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`). If you directly imported these `TypeDef`s, your code will break.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (affecting mypy-boto3-codecommit ~1.39.0+)"},{"fix":"Ensure both `boto3` and `mypy-boto3-codecommit` are installed in your environment: `pip install boto3 mypy-boto3-codecommit mypy`.","message":"mypy-boto3-codecommit provides *only* type stubs. You must also install `boto3` (and `mypy`) for your code to run and for type checking to be effective. Installing only the stubs will result in runtime `ModuleNotFoundError` for `boto3`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ideally, keep `boto3` and `mypy-boto3-codecommit` versions synchronized. Check the `mypy-boto3` builder's releases for which `boto3` version a stub package corresponds to, or use a tool like `pip-tools` to manage dependencies consistently.","message":"Type stubs are generated for specific boto3 versions. Mismatched `boto3` and `mypy-boto3-codecommit` versions can lead to incorrect type checking results (false positives/negatives) if AWS API definitions have changed significantly between versions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Integrate `mypy` into your development workflow and CI/CD pipeline (e.g., `mypy your_script.py` or `mypy .` for a project).","message":"Forgetting to run `mypy` against your code means you won't benefit from the type checking provided by `mypy-boto3-codecommit`. The stubs do not enforce types at runtime.","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"}