{"id":3165,"library":"mypy-boto3-waf-regional","title":"Mypy Boto3 WAFRegional Stubs","description":"Provides static type annotations for the 'waf-regional' service of `boto3`, enabling robust type checking for AWS WAFRegional client interactions with tools like Mypy. This package is part of the `mypy-boto3` ecosystem, currently at version 1.42.3, and updates in sync with `boto3` releases via the `mypy-boto3-builder`.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","Boto3","WAFRegional","Type Hinting","Mypy","Stubs","Static Analysis"],"install":[{"cmd":"pip install mypy-boto3-waf-regional boto3","lang":"bash","label":"Install library and its runtime dependency"}],"dependencies":[{"reason":"Runtime dependency for the AWS SDK for Python, which these stubs type-check.","package":"boto3"}],"imports":[{"note":"Type for the 'waf-regional' client returned by boto3.client().","symbol":"WAFRegionalClient","correct":"from mypy_boto3_waf_regional import WAFRegionalClient"},{"note":"Example of importing a specific TypeDef for AWS WAFRegional API responses.","symbol":"ListRulesResponseTypeDef","correct":"from mypy_boto3_waf_regional.type_defs import ListRulesResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_waf_regional import WAFRegionalClient\nfrom typing import TYPE_CHECKING\nimport os\n\n# Ensure AWS region is set for boto3, e.g., via environment variable or ~/.aws/config\nos.environ.setdefault('AWS_REGION', os.environ.get('AWS_REGION', 'us-east-1'))\n\nif TYPE_CHECKING:\n    # This block is for static type checking only, not executed at runtime.\n    # 'client' will be type-checked as WAFRegionalClient.\n    client: WAFRegionalClient = boto3.client(\"waf-regional\")\n    # Example of a type-checked API call; type checkers will validate arguments and response.\n    response = client.list_rules()\n    print(response.get('Rules')) # Type checker knows 'Rules' is a key here\nelse:\n    # This block runs at runtime. The type hint helps IDEs and linters.\n    client: WAFRegionalClient = boto3.client(\"waf-regional\")\n    try:\n        # Attempt a non-destructive API call to demonstrate functionality.\n        response = client.list_rules()\n        print(f\"Successfully listed WAFRegional rules: {len(response.get('Rules', []))} rules found.\")\n    except Exception as e:\n        print(f\"Error listing WAFRegional rules (check AWS credentials and region): {e}\")\n        print(\"To run this code, ensure AWS credentials are configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION environment variables).\")","lang":"python","description":"Demonstrates how to initialize a `boto3` WAFRegional client with type annotations and perform a simple API call. The `TYPE_CHECKING` block ensures type hints are only processed by static analyzers, while the `else` block provides runnable runtime code with basic error handling and region setup for `boto3`."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a later version to use newer stub versions.","message":"Python 3.8 support was removed from `mypy-boto3-builder` (and thus all generated stub packages) starting from version 8.12.0. Users on Python 3.8 must upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (affecting all mypy-boto3-* stub packages)"},{"fix":"Review your code for direct `TypeDef` imports and adjust names according to the updated stub definitions found in the `mypy_boto3_waf_regional.type_defs` module.","message":"Breaking changes to `TypeDef` naming conventions occurred in `mypy-boto3-builder` 8.9.0. If you directly imported and used generated `TypeDef`s, their names might have been shortened or rearranged (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (affecting all mypy-boto3-* stub packages)"},{"fix":"Ensure `pip install boto3` is part of your project's dependencies alongside the stub package.","message":"These `mypy-boto3-*` packages provide only type annotations for static analysis; they do not include the runtime functionality. You must also install the corresponding `boto3` (or `aioboto3` for async stubs) package for your application to run.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your `mypy` and Python environment are up to date. If issues arise, verify `mypy`'s `follow_imports` configuration or clear any cached environments.","message":"The `mypy-boto3` ecosystem migrated to PEP 561 compliant packages in `mypy-boto3-builder` 8.12.0. While this is primarily an internal change for package distribution, it might affect how some older build tools or specific `mypy` configurations locate and utilize type stubs.","severity":"gotcha","affected_versions":"mypy-boto3-builder >= 8.12.0 (affecting all mypy-boto3-* stub packages)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}