{"id":2126,"library":"mypy-boto3-apigateway","title":"mypy-boto3-apigateway Type Stubs","description":"mypy-boto3-apigateway provides type annotations (stubs) for the boto3 APIGateway client and its associated data structures. It's part of the `mypy-boto3` ecosystem, generated by `mypy-boto3-builder`, aiming to enhance type-checking for `boto3` users. The library is actively maintained with frequent updates, often aligning with new `boto3` and AWS API releases. The current version is 1.42.68.","status":"active","version":"1.42.68","language":"python","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["type checking","boto3","aws","mypy","apigateway","stubs","annotations"],"install":[{"cmd":"pip install mypy-boto3-apigateway boto3","lang":"bash","label":"Install specific stubs and boto3"},{"cmd":"pip install \"boto3-stubs[apigateway]\"","lang":"bash","label":"Install using boto3-stubs extra (recommended)"}],"dependencies":[{"reason":"The stubs are for the boto3 library; boto3 itself is required for runtime.","package":"boto3","optional":false},{"reason":"Direct dependency for underlying Botocore types.","package":"botocore-stubs","optional":false},{"reason":"Provides backported type features for older Python versions, explicitly listed as a requirement.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"APIGatewayClient","correct":"from mypy_boto3_apigateway.client import APIGatewayClient"},{"symbol":"GetRestApisRequestRequestTypeDef","correct":"from mypy_boto3_apigateway.type_defs import GetRestApisRequestRequestTypeDef"},{"symbol":"GetRestApisResponseTypeDef","correct":"from mypy_boto3_apigateway.type_defs import GetRestApisResponseTypeDef"},{"note":"mypy-boto3 stubs enhance the standard `boto3.client` factory method. Direct imports from `boto3.client.*` are not how boto3 clients are typically instantiated or type-hinted with these stubs.","wrong":"from boto3.client import apigateway; client = apigateway.Client()","symbol":"boto3.client","correct":"import boto3; client: APIGatewayClient = boto3.client('apigateway')"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_apigateway.client import APIGatewayClient\nfrom mypy_boto3_apigateway.type_defs import GetRestApisRequestRequestTypeDef, GetRestApisResponseTypeDef\n\n# Configure AWS credentials if not using default profile/env vars\n# import os\n# os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', '')\n# os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', '')\n# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')\n\ndef list_apigateway_rest_apis() -> None:\n    \"\"\"Lists up to 10 APIGateway REST APIs and demonstrates type hinting.\"\"\"\n    # Type hint the client for static analysis\n    client: APIGatewayClient = boto3.client(\"apigateway\")\n\n    # Use a TypedDict for request parameters, ensuring correct types and keys\n    request_params: GetRestApisRequestRequestTypeDef = {\n        \"position\": \"0\",\n        \"limit\": 10\n    }\n\n    # The response is also a TypedDict, allowing safe attribute access\n    response: GetRestApisResponseTypeDef = client.get_rest_apis(**request_params)\n\n    print(f\"Found {len(response.get('items', []))} REST APIs:\")\n    for item in response.get('items', []):\n        name = item.get('name', 'N/A')\n        api_id = item.get('id', 'N/A')\n        print(f\"- {name} (ID: {api_id})\")\n\n    # mypy would flag issues like:\n    # print(response['non_existent_key']) # Error: Key 'non_existent_key' not found in GetRestApisResponseTypeDef\n\nif __name__ == \"__main__\":\n    list_apigateway_rest_apis()\n","lang":"python","description":"This quickstart demonstrates how to initialize an APIGateway client with `boto3` and apply type hints using `mypy-boto3-apigateway`. It shows how to use generated `TypedDict` for both request parameters and response objects, enabling `mypy` to validate API calls."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Version 8.12.0 of `mypy-boto3-builder` (which generates this package) removed support for Python 3.8. Ensure your project uses Python 3.9 or higher.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Review and update `TypedDict` names in your codebase if you are upgrading from older `mypy-boto3` versions and encounter type errors related to `Request` suffixes.","message":"Starting with `mypy-boto3-builder` version 8.9.0, some TypeDef naming conventions changed. Specifically, redundant `Request` postfixes were removed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":">=8.9.0"},{"fix":"Always install `mypy-boto3-apigateway` with a version that closely matches your `boto3`/`botocore` installation. The package version (e.g., `1.42.68`) usually indicates the `botocore` version it's compatible with (e.g., `1.34.68`). Using `boto3-stubs[apigateway]` can help manage this by pinning the `botocore-stubs` dependency.","message":"Mismatching `mypy-boto3-apigateway` and `boto3`/`botocore` versions can lead to incorrect type checking or `mypy` errors. The `mypy-boto3-*` packages are generated based on specific `botocore` versions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `mypy` is configured to find stubs via standard package discovery (e.g., `pip install` places them correctly). Avoid manually manipulating `mypy_path` unless absolutely necessary, and verify paths are correct if doing so.","message":"The `mypy-boto3` ecosystem migrated to `PEP 561` compliant packages in version 8.12.0. While this change is generally transparent, ensure your `mypy` configuration (e.g., `mypy_path`) is not bypassing standard Python package discovery for type stubs.","severity":"gotcha","affected_versions":">=8.12.0"}],"env_vars":null,"search_vec":"'1.42.68':70 'activ':52 'aim':40 'align':58 'annot':13,78 'api':64 'apigateway':4,10,18,76 'associ':22 'aw':63,74 'boto3':3,9,17,32,38,47,61,73 'builder':39 'check':45,72 'client':19 'current':67 'data':23 'ecosystem':33 'enhanc':42 'frequent':55 'generat':34 'librari':50 'maintain':53 'mypi':2,8,31,37,75 'mypy-boto3':30 'mypy-boto3-apigateway':1,7 'mypy-boto3-builder':36 'new':60 'often':57 'part':27 'provid':11 'releas':65 'structur':24 'stub':6,14,77 'type':5,12,44,71 'type-check':43 'updat':56 'user':48 'version':68","created_at":"2026-04-09T18:44:38.248181+00:00","updated_at":"2026-04-16T16:44:56.974902+00:00","problems":{"verify_error":"error: Failed to parse: `mypy-boto3-apigateway boto3`\n  Caused by: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `b`\nmypy-boto3-apigateway boto3\n                      ^"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.43.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/youtype/mypy_boto3_builder","docs":"https://youtype.github.io/boto3_stubs_docs/mypy_boto3_apigateway/","changelog":null,"pypi":"https://pypi.org/project/mypy-boto3-apigateway/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"install_fail","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}