{"id":3679,"library":"mypy-boto3-qconnect","title":"Type Annotations for boto3 QConnect","description":"mypy-boto3-qconnect provides comprehensive type annotations for the AWS QConnect service client within `boto3`. It enhances development with static type checking for all QConnect operations, improving code reliability and developer experience. The current version is 1.42.84, and it follows a frequent release cadence, often aligning with `boto3` and AWS service updates, managed by the `mypy-boto3-builder`.","status":"active","version":"1.42.84","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hints","qconnect","type-stubs"],"install":[{"cmd":"pip install mypy-boto3-qconnect boto3","lang":"bash","label":"Install with boto3"}],"dependencies":[{"reason":"Runtime library for AWS SDK interactions. `mypy-boto3-qconnect` provides only type stubs, not functionality.","package":"boto3","optional":false}],"imports":[{"symbol":"QConnectClient","correct":"from mypy_boto3_qconnect.client import QConnectClient"},{"symbol":"QueryKnowledgeBaseResponseTypeDef","correct":"from mypy_boto3_qconnect.type_defs import QueryKnowledgeBaseResponseTypeDef"},{"symbol":"QConnectServiceName","correct":"from mypy_boto3_qconnect.literals import QConnectServiceName"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_qconnect.client import QConnectClient\nfrom mypy_boto3_qconnect.type_defs import QueryKnowledgeBaseResponseTypeDef\n\n# Ensure boto3 is installed and configured (e.g., via AWS CLI or env vars)\n# A client without explicit credentials will use default AWS configuration.\n\n# Use type hint for the boto3 client\nclient: QConnectClient = boto3.client(\"qconnect\")\n\n# Example: List knowledge bases\ntry:\n    # Type checking will ensure correct arguments and return types\n    response = client.list_knowledge_bases()\n    print(\"Successfully listed knowledge bases:\")\n    for kb in response.get(\"knowledgeBaseSummaries\", []):\n        print(f\"  - {kb['name']} ({kb['knowledgeBaseId']})\")\n\n    # Example with a specific operation and its TypedDict return type\n    # Note: Replace 'your-knowledge-base-id' and 'your-query' with actual values\n    # if you want to run this part.\n    # query_response: QueryKnowledgeBaseResponseTypeDef = client.query_knowledge_base(\n    #     knowledgeBaseId=\"your-knowledge-base-id\",\n    #     queryText=\"your-query\"\n    # )\n    # print(\"Query response type checked.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure your AWS credentials are configured and QConnect has resources.\")\n","lang":"python","description":"Demonstrates how to initialize a `boto3` QConnect client with `mypy-boto3-qconnect` type hints and perform a basic operation, showcasing how types are applied to both the client and its method responses."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin an older `mypy-boto3-qconnect` version (e.g., `mypy-boto3-qconnect<1.42.0`).","message":"Python 3.8 is no longer supported. Packages built with `mypy-boto3-builder` version 8.12.0 and higher (including `mypy-boto3-qconnect 1.42.84`) require Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-qconnect <= 1.41.x (built with builder < 8.12.0) support Python 3.8. Versions >= 1.42.x require Python 3.9+."},{"fix":"Always install both `mypy-boto3-qconnect` and `boto3`: `pip install mypy-boto3-qconnect boto3`.","message":"This package provides only type stubs. You must install `boto3` separately for actual runtime functionality. Forgetting `boto3` will lead to `ModuleNotFoundError` or similar runtime issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your code to use the simplified `TypeDef` names. For `QConnect`, explicitly check relevant `TypedDict`s for breaking changes if upgrading from very old versions.","message":"Some `TypedDict` argument names (e.g., `CreateDistributionRequestRequestTypeDef`) were shortened or renamed to avoid redundancy in `mypy-boto3-builder` 8.9.0. While `qconnect` specifically fixed self-references in 8.11.0, other services saw general renaming. Review your code for `*RequestRequestTypeDef` patterns.","severity":"breaking","affected_versions":"mypy-boto3-qconnect built with builder < 8.9.0 might use longer, redundant TypeDef names. Versions built with >= 8.9.0 use shorter names."},{"fix":"Ensure you are using `mypy-boto3-qconnect` version built with `mypy-boto3-builder` 8.11.0 or newer (e.g., `1.42.x` or later) to benefit from the fix.","message":"Previous versions of `mypy-boto3-qconnect` (built with `mypy-boto3-builder` prior to 8.11.0) had issues with self-references in `TypedDict`s which could lead to incorrect type checking or errors. This was specifically fixed for `qconnect`.","severity":"gotcha","affected_versions":"mypy-boto3-qconnect versions built with `mypy-boto3-builder < 8.11.0`."},{"fix":"Ensure your `mypy` configuration is up-to-date. Typically, no direct action is needed unless you encounter type resolution errors not present in earlier versions.","message":"The `mypy-boto3-builder` migrated to PEP 561-compliant packages in version 8.12.0. This change ensures better compatibility with `mypy` and other type checkers but might require `mypy` to be updated or reconfigured in some complex setups if type resolution issues arise.","severity":"gotcha","affected_versions":"All versions built with `mypy-boto3-builder` 8.12.0 and later."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}