{"id":3604,"library":"mypy-boto3-kendra-ranking","title":"mypy-boto3-kendra-ranking Type Stubs","description":"mypy-boto3-kendra-ranking provides comprehensive type annotations for the `boto3` KendraRanking service. It is part of the `mypy-boto3` project, which generates complete type stubs for all AWS services supported by `boto3` and `aioboto3`. This library enhances code quality and maintainability by enabling static type checking of `boto3` usage in Python projects. The current version is `1.42.3`, generated with `mypy-boto3-builder 8.12.0`, and new versions are released frequently to synchronize with `boto3` updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","kendra","type-hints","mypy","stubs","static-analysis"],"install":[{"cmd":"pip install boto3 mypy-boto3-kendra-ranking mypy","lang":"bash","label":"Install core libraries and stubs"}],"dependencies":[{"reason":"This library provides type stubs for boto3.","package":"boto3"},{"reason":"Required to perform static type checking using these stubs.","package":"mypy"},{"reason":"Automatically included by the builder for Python versions older than 3.9 to support advanced type features.","package":"typing-extensions","optional":true}],"imports":[{"note":"Import for type-hinting the boto3 KendraRanking client object.","symbol":"KendraRankingClient","correct":"from mypy_boto3_kendra_ranking.client import KendraRankingClient"},{"note":"Import for type-hinting a specific response structure from the service.","symbol":"ListTagsForResourceResponseTypeDef","correct":"from mypy_boto3_kendra_ranking.type_defs import ListTagsForResourceResponseTypeDef"}],"quickstart":{"code":"import os\nimport boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_kendra_ranking.client import KendraRankingClient\n    from mypy_boto3_kendra_ranking.type_defs import ListTagsForResourceResponseTypeDef\n\ndef get_kendra_ranking_client() -> \"KendraRankingClient\":\n    # In a real application, credentials would be managed securely.\n    # For quickstart, using default session or explicit credentials from env\n    return boto3.client(\"kendra-ranking\",\n                        region_name=os.environ.get(\"AWS_REGION\", \"us-east-1\"),\n                        aws_access_key_id=os.environ.get(\"AWS_ACCESS_KEY_ID\", \"TEST_KEY\"),\n                        aws_secret_access_key=os.environ.get(\"AWS_SECRET_ACCESS_KEY\", \"TEST_SECRET\"))\n\ndef list_kendra_ranking_resource_tags(resource_arn: str) -> None:\n    client: KendraRankingClient = get_kendra_ranking_client()\n    try:\n        response: ListTagsForResourceResponseTypeDef = client.list_tags_for_resource(\n            ResourceARN=resource_arn\n        )\n        print(f\"Tags for {resource_arn}:\")\n        for tag in response.get(\"Tags\", []):\n            print(f\"  {tag['Key']}: {tag['Value']}\")\n    except client.exceptions.ResourceNotFoundException:\n        print(f\"Resource with ARN '{resource_arn}' not found.\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    # Replace with a valid KendraRanking resource ARN if you want to run it against AWS\n    # Example: 'arn:aws:kendra-ranking:us-east-1:123456789012:rank-evaluation/example'\n    # For a quickstart that runs without AWS credentials, a dummy ARN is fine for type checking.\n    dummy_arn = \"arn:aws:kendra-ranking:us-east-1:123456789012:rank-evaluation/dummy-evaluation\"\n    list_kendra_ranking_resource_tags(dummy_arn)\n    print(\"\\nRun `mypy your_script_name.py` to check types.\")","lang":"python","description":"This example demonstrates how to type-hint a `boto3` KendraRanking client and use a typical operation, `list_tags_for_resource`. Run `mypy <your_script_name>.py` to verify type correctness."},"warnings":[{"fix":"Upgrade your Python environment to version 3.9 or higher.","message":"Python 3.8 support has been removed in `mypy-boto3-builder` version 8.12.0 and later. Corresponding `mypy-boto3` packages no longer support Python 3.8.","severity":"breaking","affected_versions":"mypy-boto3-builder>=8.12.0, mypy-boto3-kendra-ranking>=1.42.0"},{"fix":"Ensure your packaging and environment setup is compatible with PEP 561-style packages. Most users will not need to take explicit action beyond standard `pip` usage.","message":"The `mypy-boto3` project migrated to PEP 561 compliant packages in builder version 8.12.0. While this primarily affects package structure, it can have implications for custom packaging workflows or specific tooling integrations.","severity":"breaking","affected_versions":"mypy-boto3-builder>=8.12.0"},{"fix":"Consult the generated stub files (e.g., `mypy_boto3_kendra_ranking.type_defs`) or the official documentation for the correct, current TypeDef names.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Some TypeDefs for method arguments were shortened (e.g., `RequestRequestTypeDef` -> `RequestTypeDef`). Users referencing older TypeDef names will encounter type errors.","severity":"gotcha","affected_versions":"mypy-boto3-builder>=8.9.0"},{"fix":"Double-check the service name argument for `boto3.client()` and ensure it aligns with the `mypy-boto3-<service-name>` package, especially after `boto3` or `mypy-boto3` updates.","message":"Service names in AWS can sometimes change or be deprecated (e.g., `sms-voice` was replaced by `pinpoint-sms-voice` in builder 8.11.0). Always verify the exact service name used in `boto3.client()` matches the `mypy-boto3-*` package you install.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `mypy` is installed (`pip install mypy`) and run it on your codebase (e.g., `mypy your_script.py`). For complex projects, consider a `pyproject.toml` or `mypy.ini` configuration.","message":"For `mypy` to properly find and utilize these stubs, it must be installed and configured correctly. Forgetting to install `mypy` or running it without proper paths are common issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regularly update your `mypy-boto3-*` packages alongside `boto3` to ensure type definitions remain synchronized with the underlying library.","message":"Stubs can become outdated if `boto3` is updated to a newer version with API changes that are not yet reflected in the corresponding `mypy-boto3-*` package.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}