{"id":3171,"library":"mypy-boto3-workmail","title":"mypy-boto3-workmail Type Annotations","description":"mypy-boto3-workmail provides type annotations for the `boto3` WorkMail service, enabling static type checking with tools like MyPy and Pyright for `boto3.client('workmail')` calls. It is automatically generated by `mypy-boto3-builder` and is frequently updated in sync with `boto3` and `botocore` releases to provide up-to-date type hints.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["mypy","boto3","aws","type-hints","stubs","workmail","type-checking"],"install":[{"cmd":"pip install mypy-boto3-workmail boto3","lang":"bash","label":"Install with boto3"},{"cmd":"pip install 'boto3-stubs[workmail]' boto3","lang":"bash","label":"Install via boto3-stubs extra"}],"dependencies":[{"reason":"Runtime dependency for interacting with AWS WorkMail service.","package":"boto3","optional":false},{"reason":"Optional: For static type checking of Python code.","package":"mypy","optional":true},{"reason":"Optional: For static type checking of Python code.","package":"pyright","optional":true}],"imports":[{"note":"Provides type annotations for `boto3.client(\"workmail\")`.","symbol":"WorkMailClient","correct":"from mypy_boto3_workmail.client import WorkMailClient"},{"note":"Example of importing a generated TypedDict for request/response payloads.","symbol":"AccessControlRuleTypeDef","correct":"from mypy_boto3_workmail.type_defs import AccessControlRuleTypeDef"},{"note":"Example of importing a generated Literal type for specific string values.","symbol":"AccessControlRuleEffectType","correct":"from mypy_boto3_workmail.literals import AccessControlRuleEffectType"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_workmail.client import WorkMailClient\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    client: WorkMailClient\nelse:\n    client = boto3.client(\"workmail\")\n\n# Example usage: List organizations\n# client = boto3.client(\"workmail\") # In actual runtime, use this line\n\ntry:\n    response = client.list_organizations(MaxResults=5) # Type-checked call\n    for org in response.get(\"OrganizationSummaries\", []):\n        print(f\"Organization ID: {org['OrganizationId']}, State: {org['State']}\")\nexcept client.exceptions.OrganizationNotFoundException:\n    print(\"No WorkMail organizations found.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted WorkMail client using `mypy-boto3-workmail` and perform a basic API call like listing organizations. The `TYPE_CHECKING` block ensures that `mypy-boto3-workmail` is only used for type checking and not as a runtime dependency. Remember to have `boto3` installed for runtime execution."},"warnings":[{"fix":"Upgrade Python to 3.9+ or pin `mypy-boto3-workmail` to an older version compatible with Python 3.8 (e.g., <1.42.0).","message":"Python 3.8 support was removed starting with `mypy-boto3-builder` version 8.12.0. If you are using an older Python version, you must use an older `mypy-boto3-workmail` release or upgrade your Python environment.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (which generates mypy-boto3-workmail versions 1.42.0+)"},{"fix":"Update `TypeDef` import paths and names in your code to match the new convention. Review the specific service's `type_defs` module.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Specifically, 'RequestRequestTypeDef' was shortened to 'RequestTypeDef' and 'Extra' postfixes moved to the end. This can break existing explicit `TypeDef` imports.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder (which generates mypy-boto3-workmail versions 1.42.0+)"},{"fix":"Use a conditional assignment within a `if TYPE_CHECKING:` block, setting runtime variables to `object` in the `else` branch, as shown in the quickstart example.","message":"Pylint may raise `undefined-variable` warnings for type-hinted `boto3` clients when `mypy-boto3-workmail` is installed. This is due to how Pylint handles the `TYPE_CHECKING` guard.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `boto3` is installed alongside `mypy-boto3-workmail` (e.g., `pip install mypy-boto3-workmail boto3`).","message":"This package provides *only* type annotations. You must also install the `boto3` library to actually make AWS API calls at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"It is recommended to use `boto3-stubs-lite` instead of the full `boto3-stubs` or `mypy-boto3-*` packages, as the lite versions are more RAM-friendly and mitigate this issue. Note that `boto3-stubs-lite` requires more explicit type annotations.","message":"For PyCharm users, there can be performance issues with `Literal` overloads provided by `mypy-boto3-workmail`. PyCharm's indexing might be slow.","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"}