{"id":3166,"library":"mypy-boto3-waf","title":"mypy-boto3-waf","description":"mypy-boto3-waf provides type annotations for the AWS WAF service client in boto3, enabling static type checking with tools like Mypy. It is part of the mypy-boto3-builder project, which generates stubs for all boto3 services. The library is actively maintained, with version 1.42.3 available, and releases are frequent, typically aligned with updates to boto3 and the builder itself.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","waf","mypy","type-checking","stubs"],"install":[{"cmd":"pip install mypy-boto3-waf","lang":"bash","label":"Install library"}],"dependencies":[{"reason":"Provides the AWS SDK for Python, which these stubs type-check.","package":"boto3"},{"reason":"The static type checker that utilizes these stubs.","package":"mypy","optional":true},{"reason":"Required for full compatibility with Python versions < 3.11.","package":"typing_extensions","optional":true}],"imports":[{"symbol":"WAFClient","correct":"from mypy_boto3_waf.client import WAFClient"},{"symbol":"WAFServiceResource","correct":"from mypy_boto3_waf.service_resource import WAFServiceResource"},{"symbol":"CreateWebACLRequestRequestTypeDef","correct":"from mypy_boto3_waf.type_defs import CreateWebACLRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_waf.client import WAFClient\n\ndef get_waf_webacls() -> None:\n    # mypy will now correctly type-check 'client'\n    client: WAFClient = boto3.client(\"waf\")\n    try:\n        response = client.list_web_acls()\n        for web_acl in response.get(\"WebACLs\", []):\n            print(f\"WebACL Name: {web_acl['Name']}, ID: {web_acl['WebACLId']}\")\n    except Exception as e:\n        print(f\"Error listing WebACLs: {e}\")\n\nif __name__ == \"__main__\":\n    get_waf_webacls()","lang":"python","description":"This quickstart demonstrates how to import and use the type hints for the AWS WAF client. By annotating the boto3 client with `WAFClient`, Mypy can provide static analysis for WAF service calls, ensuring correct parameter types and return values."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If this is not possible, pin to an older `mypy-boto3-waf` version (e.g., `<1.42.3`) that supported Python 3.8.","message":"Support for Python 3.8 has been officially removed starting from mypy-boto3-builder 8.12.0 (which generated mypy-boto3-waf 1.42.3). Users on Python 3.8 will need to upgrade their Python version to 3.9 or higher.","severity":"breaking","affected_versions":">=1.42.3"},{"fix":"Update explicit references to TypeDef names in your code to match the new shorter or reordered conventions. Consult the `mypy_boto3_waf.type_defs` module for the correct names.","message":"TypeDef naming conventions were changed in mypy-boto3-builder 8.9.0. TypeDefs for packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Additionally, conflicting `Extra` postfixes were moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":">=1.38.0 (generated by builder 8.9.0)"},{"fix":"Remove any explicit `mypy_path` configurations pointing to `mypy-boto3` or `mypy-boto3-waf` stubs from your `mypy.ini` or CLI arguments, and rely on Mypy's automatic PEP 561 stub discovery.","message":"The library migrated to PEP 561 compliance in mypy-boto3-builder 8.12.0. While this generally improves stub discovery for Mypy, users who previously configured custom `mypy_path` entries for `mypy-boto3` stubs might experience conflicts or incorrect stub loading. Mypy should now automatically discover these stubs if installed correctly.","severity":"gotcha","affected_versions":">=1.42.3"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}