{"id":3167,"library":"mypy-boto3-wafv2","title":"Type Annotations for boto3 WAFV2","description":"Type annotations for boto3 WAFV2 service, part of the `mypy-boto3` project. This project provides comprehensive type hints for `boto3` and `aioboto3` AWS SDKs, enhancing static analysis, IDE autocompletion, and catching type-related errors before runtime. It closely follows `botocore` updates, generating up-to-date service-specific stubs. The current version is 1.42.57, generated with `mypy-boto3-builder` 8.12.0.","status":"active","version":"1.42.57","language":"python","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hints","wafv2","static-analysis","autocompletion"],"install":[{"cmd":"pip install mypy-boto3-wafv2","lang":"bash","label":"Install service-specific stubs"},{"cmd":"pip install 'boto3-stubs[wafv2]'","lang":"bash","label":"Install as part of boto3-stubs meta-package"}],"dependencies":[{"reason":"This package provides type hints for boto3. Boto3 itself must be installed for the code to run.","package":"boto3","optional":false},{"reason":"Required for static type checking; pyright is also supported.","package":"mypy","optional":true}],"imports":[{"wrong":"from mypy_boto3_wafv2 import WAFV2Client","symbol":"WAFV2Client","correct":"from mypy_boto3_wafv2 import WAFV2Client"},{"symbol":"WAFV2ServiceResource","correct":"from mypy_boto3_wafv2 import WAFV2ServiceResource"},{"symbol":"ServiceResource","correct":"from mypy_boto3_wafv2 import ServiceResource"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nfrom mypy_boto3_wafv2 import WAFV2Client\n\nif TYPE_CHECKING:\n    # Only imported for type checking, not for runtime\n    pass\n\ndef get_wafv2_client() -> WAFV2Client:\n    # The boto3.client call is automatically typed by mypy-boto3\n    # if 'boto3-stubs' or 'mypy-boto3-wafv2' is installed.\n    client: WAFV2Client = boto3.client(\"wafv2\")\n    return client\n\n# Example usage (runtime functionality requires AWS credentials)\n# client = get_wafv2_client()\n# try:\n#     response = client.list_web_acls(Scope='CLOUDFRONT')\n#     print(response['WebACLs'])\n# except Exception as e:\n#     print(f\"Error listing Web ACLs: {e}\")","lang":"python","description":"Demonstrates how to obtain a type-hinted WAFV2 client using boto3. The `TYPE_CHECKING` block is a common pattern to avoid runtime dependencies on the stub package while still getting type hints during static analysis."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later.","message":"Python 3.8 support has been removed since `mypy-boto3-builder` version 8.12.0. All `mypy-boto3-*` packages now require Python 3.9 or newer.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder, affecting all generated stubs"},{"fix":"Ensure your environment correctly handles PEP 561 compliant stub packages. Most standard Python tools (pip, setuptools) should handle this automatically.","message":"The `mypy-boto3` project migrated to PEP 561 for package structure with `mypy-boto3-builder` 8.12.0. This changes how stub packages are distributed and might affect custom tooling or build processes that relied on the previous package layout.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder, affecting all generated stubs"},{"fix":"Update your code to use the new, shorter TypeDef names. Refer to the specific service's documentation for correct names or rely on IDE autocompletion.","message":"Type definition (TypedDict) naming conventions were changed in `mypy-boto3-builder` 8.9.0. This can break code that explicitly references old TypeDef names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder, affecting all generated stubs"},{"fix":"In the `else` block of your `TYPE_CHECKING` guard, explicitly assign the imported types to `object`, e.g., `else: WAFV2Client = object`.","message":"When using `if TYPE_CHECKING:` guards to conditionally import type hints, Pylint might report undefined variables if the types are not explicitly assigned to `object` in the `else` branch. Mypy and other type checkers are generally fine without this.","severity":"gotcha","affected_versions":"All versions when using Pylint with `TYPE_CHECKING` guards"}],"env_vars":null,"search_vec":"'1.42.57':62 '8.12.0':69 'aioboto3':28 'analysi':33,79 'annot':2,7 'autocomplet':35,80 'aw':29,72 'boto3':4,9,17,26,67,71 'botocor':47 'builder':68 'catch':37 'close':45 'comprehens':22 'current':59 'date':53 'enhanc':31 'error':41 'follow':46 'generat':49,63 'hint':24,75 'ide':34 'mypi':16,66,70 'mypy-boto3':15 'mypy-boto3-builder':65 'part':12 'project':18,20 'provid':21 'relat':40 'runtim':43 'sdks':30 'servic':11,55 'service-specif':54 'specif':56 'static':32,78 'static-analysi':77 'stub':57 'type':1,6,23,39,74 'type-hint':73 'type-rel':38 'up-to-d':50 'updat':48 'version':60 'wafv2':5,10,76","created_at":"2026-04-11T09:23:54.153423+00:00","updated_at":"2026-04-16T17:17:01.071067+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\n  File \"/tmp/tmpei56bu9t/venv/lib/python3.12/site-packages/mypy_boto3_wafv2/__init__.py\", line 22, in <module>\n    from .client import WAFV2Client\n  File \"/tmp/tmpei56bu9t/venv/lib/python3.12/site-packages/mypy_boto3_wafv2/cli"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.43.78","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_wafv2/","changelog":null,"pypi":"https://pypi.org/project/mypy-boto3-wafv2/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-08-28","next_check":"2026-07-10","install_tag":null}}