{"id":3064,"library":"mypy-boto3-connect","title":"mypy-boto3-connect Type Stubs","description":"mypy-boto3-connect provides comprehensive type annotations for the AWS SDK for Python (boto3) specifically for the AWS Connect service. It is automatically generated by `mypy-boto3-builder` (currently version 8.12.0) and helps users catch type-related errors at development time, improving code quality and maintainability. The current version of these stubs is 1.42.88, reflecting the boto3 version.","status":"active","version":"1.42.88","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","boto3","mypy","type-stubs","static-analysis","Connect"],"install":[{"cmd":"pip install boto3 mypy-boto3-connect mypy","lang":"bash","label":"Install with Mypy"}],"dependencies":[{"reason":"This library provides type stubs for boto3; boto3 itself is required for runtime functionality.","package":"boto3"},{"reason":"mypy is the static type checker that utilizes these stubs for type validation.","package":"mypy","optional":true}],"imports":[{"symbol":"ConnectClient","correct":"from mypy_boto3_connect import ConnectClient"},{"symbol":"ConnectServiceResource","correct":"from mypy_boto3_connect import ConnectServiceResource"},{"note":"Type definitions are typically found in the `type_defs` submodule, not directly in `client`.","wrong":"from mypy_boto3_connect.client import InstanceTypeDef","symbol":"InstanceTypeDef","correct":"from mypy_boto3_connect.type_defs import InstanceTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_connect import ConnectClient\nfrom mypy_boto3_connect.type_defs import CreateInstanceRequestRequestTypeDef, InstanceTypeDef\n\n# Instantiate the boto3 client and cast it to the Mypy-Boto3 type for type checking\nconnect_client: ConnectClient = boto3.client(\"connect\")\n\n# Example usage with type-hinted data\n# Note: This is a placeholder; actual Connect operations might require more complex setup.\n# Replace with actual data relevant to your AWS Connect instance.\ncreate_instance_request: CreateInstanceRequestRequestTypeDef = {\n    \"ClientToken\": \"example-token\",\n    \"IdentityManagementType\": \"SAML\", # Other options: 'CONNECT_MANAGED', 'EXISTING_DIRECTORY'\n    \"InstanceAlias\": \"my-test-instance-alias\",\n    \"DirectoryId\": \"dir-xxxxxxxx\", # Required if IdentityManagementType is EXISTING_DIRECTORY\n    \"InboundCallsEnabled\": True,\n    \"OutboundCallsEnabled\": True\n}\n\n# The actual call might fail without correct setup, this demonstrates type usage\ntry:\n    # This call is illustrative for type checking, it will likely fail without a real setup.\n    response = connect_client.create_instance(\n        IdentityManagementType=create_instance_request[\"IdentityManagementType\"],\n        InstanceAlias=create_instance_request[\"InstanceAlias\"],\n        InboundCallsEnabled=create_instance_request[\"InboundCallsEnabled\"],\n        OutboundCallsEnabled=create_instance_request[\"OutboundCallsEnabled\"]\n    )\n    # The response object will also be type-hinted if Mypy is run\n    instance_summary: InstanceTypeDef = response[\"InstanceSummary\"]\n    print(f\"Instance created with ARN: {instance_summary['Arn']}\")\nexcept Exception as e:\n    print(f\"Could not create instance (this is expected without a valid setup): {e}\")\n\n# Example of getting an existing instance (requires an actual instance ARN)\ntry:\n    # Replace with a real instance ARN if you want to test live\n    instance_id = \"arn:aws:connect:REGION:ACCOUNT_ID:instance/INSTANCE_ID\"\n    # This call is illustrative for type checking\n    response = connect_client.describe_instance(InstanceId=instance_id)\n    instance_summary: InstanceTypeDef = response['Instance']['InstanceSummary']\n    print(f\"Described instance ID: {instance_summary['Id']}\")\nexcept connect_client.exceptions.ResourceNotFoundException:\n    print(f\"Instance {instance_id} not found.\")\nexcept Exception as e:\n    print(f\"Could not describe instance (this is expected without a valid ARN): {e}\")","lang":"python","description":"This quickstart demonstrates how to import `ConnectClient` and use it to type-hint a `boto3` AWS Connect client. It shows an example of using type-hinted request parameters for `create_instance` and retrieving `InstanceTypeDef` from the response, leveraging the static type checking provided by `mypy-boto3-connect`."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. This affects all generated stubs, including `mypy-boto3-connect`. Ensure your project uses Python 3.9 or higher.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0 (and dependent stubs)"},{"fix":"Ensure your type-checking environment (e.g., `mypy`) is up-to-date. No specific code changes are typically required unless you're using custom stub discovery.","message":"All `mypy-boto3` packages, including `mypy-boto3-connect`, migrated to PEP 561 compliant packages in `mypy-boto3-builder` version 8.12.0. This might affect how some tools discover and use stubs, though `mypy` typically handles this gracefully.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0 (and dependent stubs)"},{"fix":"Review your code for any explicit imports of TypeDefs. If you encounter `NameError` or type-checking issues with TypeDefs, consult the `mypy_boto3_connect.type_defs` module for the updated names.","message":"In `mypy-boto3-builder` version 8.9.0, TypeDef naming conventions changed for packed method arguments and conflicting names. TypeDefs like `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `Extra` postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`). While `mypy-boto3-connect` may not directly use these specific examples, similar renames could affect Connect-specific TypeDefs.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0 (and dependent stubs)"},{"fix":"If using SMS Voice, migrate to `mypy-boto3-pinpoint-sms-voice`.","message":"The `sms-voice` service was deprecated and removed from `mypy-boto3-builder` in version 8.11.0. Users should migrate to `pinpoint-sms-voice` instead. This is a general `mypy-boto3` warning, not directly affecting `mypy-boto3-connect`, but important for users of the overall `mypy-boto3` ecosystem.","severity":"deprecated","affected_versions":"mypy-boto3-builder >=8.11.0"},{"fix":"Ensure `pip install boto3 mypy-boto3-connect` is run to install both the runtime library and its type stubs.","message":"You must install `boto3` alongside `mypy-boto3-connect`. `mypy-boto3-connect` only provides type stubs and does not include the runtime `boto3` library itself. Without `boto3`, your code will fail at runtime.","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"}