mypy-boto3-cloudfront-keyvaluestore Type Annotations
mypy-boto3-cloudfront-keyvaluestore provides type annotations for the boto3 CloudFrontKeyValueStore client, allowing for static type checking with tools like MyPy. It is generated by `mypy-boto3-builder` and its version is synchronized with the corresponding `boto3` and `types-botocore-cloudfront-keyvaluestore` versions. The library receives frequent updates, typically aligning with new boto3 releases and `mypy-boto3-builder` enhancements.
Warnings
- breaking Python 3.8 support has been removed since `mypy-boto3-builder` version 8.12.0. If you are using `mypy-boto3-cloudfront-keyvaluestore` version 1.42.3 or newer, your project must use Python 3.9 or higher.
- gotcha The version of `mypy-boto3-cloudfront-keyvaluestore` must closely match your installed `boto3` version. Mismatched versions can lead to incorrect or missing type hints, causing MyPy errors or silently allowing runtime issues.
- breaking Starting with `mypy-boto3-builder` version 8.9.0, some TypeDef names were changed to be shorter (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and conflicting `Extra` postfixes were reordered. While this specific service might not be directly affected, be aware of potential TypeDef renaming if migrating existing code using `mypy-boto3`.
- gotcha Beginning with `mypy-boto3-builder` version 8.12.0, all generated packages migrated to PEP 561. This change is generally beneficial but might require ensuring your build system or `mypy` configuration correctly discovers the stubs, especially in complex project setups or when using `pip install -e .` (editable installs).
Install
-
pip install mypy-boto3-cloudfront-keyvaluestore
Imports
- CloudFrontKeyValueStoreClient
from mypy_boto3_cloudfront_keyvaluestore.client import CloudFrontKeyValueStoreClient
- Client
from mypy_boto3_cloudfront_keyvaluestore import Client as CloudFrontKeyValueStoreClient
Quickstart
import boto3
from mypy_boto3_cloudfront_keyvaluestore.client import CloudFrontKeyValueStoreClient
def get_key_value_client() -> CloudFrontKeyValueStoreClient:
"""Gets a typed CloudFront KeyValueStore client."""
client: CloudFrontKeyValueStoreClient = boto3.client("cloudfront-keyvaluestore")
return client
# Example usage (requires an AWS setup, e.g., via ~/.aws/credentials)
if __name__ == "__main__":
try:
cfkvs_client = get_key_value_client()
print(f"Successfully created CloudFront KeyValueStore client: {cfkvs_client.meta.region_name}")
# You can now use cfkvs_client with type hints
# For example, to list key value stores (if you have any):
# response = cfkvs_client.list_key_value_stores()
# print(response)
except Exception as e:
print(f"Error creating client: {e}")