Registry / type-stubs / mypy-boto3-apigateway

mypy-boto3-apigateway

JSON →
library1.42.68pypypiunverified

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.

type-stubsaws
pip install mypy-boto3-apigateway boto3
Install & Compatibility
Where this runs
tested against v1.43.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
9/10 runs
9/10 runs
py 3.11
9/10 runs
9/10 runs
py 3.12
9/10 runs
9/10 runs
py 3.13
9/10 runs
9/10 runs
py 3.9
9/10 runs
9/10 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

APIGatewayClient
from mypy_boto3_apigateway.client import APIGatewayClient
GetRestApisRequestRequestTypeDef
from mypy_boto3_apigateway.type_defs import GetRestApisRequestRequestTypeDef
GetRestApisResponseTypeDef
from mypy_boto3_apigateway.type_defs import GetRestApisResponseTypeDef
boto3.client
import boto3; client: APIGatewayClient = boto3.client('apigateway')
from boto3.client import apigateway; client = apigateway.Client()
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.

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.

import boto3 from mypy_boto3_apigateway.client import APIGatewayClient from mypy_boto3_apigateway.type_defs import GetRestApisRequestRequestTypeDef, GetRestApisResponseTypeDef # Configure AWS credentials if not using default profile/env vars # import os # os.environ['AWS_ACCESS_KEY_ID'] = os.environ.get('AWS_ACCESS_KEY_ID', '') # os.environ['AWS_SECRET_ACCESS_KEY'] = os.environ.get('AWS_SECRET_ACCESS_KEY', '') # os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1') def list_apigateway_rest_apis() -> None: """Lists up to 10 APIGateway REST APIs and demonstrates type hinting.""" # Type hint the client for static analysis client: APIGatewayClient = boto3.client("apigateway") # Use a TypedDict for request parameters, ensuring correct types and keys request_params: GetRestApisRequestRequestTypeDef = { "position": "0", "limit": 10 } # The response is also a TypedDict, allowing safe attribute access response: GetRestApisResponseTypeDef = client.get_rest_apis(**request_params) print(f"Found {len(response.get('items', []))} REST APIs:") for item in response.get('items', []): name = item.get('name', 'N/A') api_id = item.get('id', 'N/A') print(f"- {name} (ID: {api_id})") # mypy would flag issues like: # print(response['non_existent_key']) # Error: Key 'non_existent_key' not found in GetRestApisResponseTypeDef if __name__ == "__main__": list_apigateway_rest_apis()
Debug
Known issues
breakingVersion 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.
fix
Upgrade your Python environment to 3.9 or newer.
affects: >=8.12.0
breakingStarting with `mypy-boto3-builder` version 8.9.0, some TypeDef naming conventions changed. Specifically, redundant `Request` postfixes were removed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).
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.
affects: >=8.9.0
gotchaMismatching `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.
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.
affects: All versions
gotchaThe `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.
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.
affects: >=8.12.0
Upgrade
Version history
1.43.0latest on PyPI
Audit
Dependencies
boto3requiredThe stubs are for the boto3 library; boto3 itself is required for runtime.
botocore-stubsrequiredDirect dependency for underlying Botocore types.
typing-extensionsoptionalProvides backported type features for older Python versions, explicitly listed as a requirement.
Agent activity
44 hits · last 30 days
ahrefsbot
3
node
2
Amazon
2
seranking-bot
2
Resources