Registry / type-stubs / mypy-boto3-apigatewayv2

mypy-boto3-apigatewayv2

JSON →
library1.43.0pypypi✓ verified 28d ago

mypy-boto3-apigatewayv2 provides a complete set of type annotations for the boto3 ApiGatewayV2 client and associated data structures, enabling static type checking with tools like MyPy. It ensures type safety and autocompletion for AWS SDK usage. The current version is 1.42.76, aligning with the `boto3` version it targets. New versions are released frequently in sync with `mypy-boto3-builder` updates and AWS API changes.

pip install boto3 mypy-boto3-apigatewayv2 mypy
INSTALL
IMPORT
SIG · MYPY-BOTO3-APIGATE
M
mypy-boto3-apigatewayv2
type-stubspythonv1.43.0
Install
6.1s avg
Import
690ms
Disk
114MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
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
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.726s · 116.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 6.1s · import 0.654s · 115MB
114MB installed
● package 114MB
Code
Verified usage

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

ApiGatewayV2Client
✓ from mypy_boto3_apigatewayv2.client import ApiGatewayV2Client
CreateApiRequestRequestTypeDef
✓ from mypy_boto3_apigatewayv2.type_defs import CreateApiRequestRequestTypeDef
mypy_boto3_apigatewayv2
✓ import mypy_boto3_apigatewayv2
Importing the top-level package helps MyPy discover the stubs implicitly.

This quickstart demonstrates how to use `mypy-boto3-apigatewayv2` to add type annotations to a `boto3` client. It shows both explicit type hinting for the client and for a request dictionary, which MyPy uses to provide autocompletion and detect type mismatches. Note that `boto3` must be installed alongside the stub package.

import boto3 import mypy_boto3_apigatewayv2 # Import for MyPy to discover stubs from mypy_boto3_apigatewayv2.client import ApiGatewayV2Client from mypy_boto3_apigatewayv2.type_defs import CreateApiRequestRequestTypeDef # Instantiate a boto3 client at runtime. The stub package provides type annotations. client: ApiGatewayV2Client = boto3.client("apigatewayv2") print(f"Client type at runtime: {type(client)}") # Example of a type-checked input dictionary for a method call # MyPy will validate that 'create_api_params' conforms to CreateApiRequestRequestTypeDef create_api_params: CreateApiRequestRequestTypeDef = { "Name": "MyExampleApiForTypes", "ProtocolType": "WEBSOCKET", # or 'HTTP' "Description": "API created for type demonstration", "Tags": {"Project": "ChecklistDay"} # Add other required parameters as per AWS API Gateway V2 documentation if performing a real call } # Although this call will likely fail without valid AWS credentials and full required parameters, # it is syntactically correct and demonstrates where type-checking benefits apply. try: response = client.create_api(**create_api_params) print(f"Attempted to create API with ID: {response.get('ApiId', 'N/A')}") except Exception as e: print(f"Note: API call failed, likely due to missing AWS credentials or incomplete parameters. Error: {e}") # MyPy would ensure that 'response' is treated as a CreateApiResultTypeDef.
Debug
Known issues
breakingPython 3.8 support was removed from `mypy-boto3-builder` starting with version 8.12.0. Consequently, stub packages generated by this builder version (and newer) require Python 3.9 or higher.
fix
Ensure your project uses Python 3.9 or newer. For older Python versions, pin an older `mypy-boto3-builder` version or downgrade the specific stub packages if compatible versions exist.
affects: mypy-boto3-builder >= 8.12.0 (and generated stubs including mypy-boto3-apigatewayv2)
breakingTypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0, potentially affecting custom TypeDef names. For instance, `CreateDistributionRequestRequestTypeDef` might become `CreateDistributionRequestTypeDef`.
fix
Review and update explicit TypeDef imports and usage in your codebase, especially for complex request/response types. Consult the generated stub files for the exact new names.
affects: mypy-boto3-builder >= 8.9.0 (and generated stubs)
gotchaThe `mypy-boto3-apigatewayv2` package provides only type stubs, not the actual runtime implementation of the AWS SDK. `boto3` must be installed separately for your application to function.
fix
Always include `pip install boto3` alongside `pip install mypy-boto3-apigatewayv2` in your project setup.
affects: All
gotchaType stubs are not meant for direct instantiation. For example, do not attempt to call `mypy_boto3_apigatewayv2.client.ApiGatewayV2Client()` directly. Instead, use `boto3.client('apigatewayv2')` and let MyPy infer or be guided by the imported types.
fix
Always create AWS service clients using `boto3.client('service_name')` or `boto3.resource('service_name')`. Use the imported types from `mypy_boto3_apigatewayv2` solely for type annotations.
affects: All
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for boto3, which must be installed separately for runtime functionality.
mypyrequiredMyPy is the primary static type checker designed to utilize these annotations.
typing-extensionsoptionalMay be required by generated stub packages for older Python versions (<3.9), though typically managed automatically.
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
mypy-boto3-apigatewayv2 — pip install mypy-boto3-apigatewayv2 · libregistry