{"id":3174,"library":"mypy-boto3-workspaces","title":"Type Annotations for boto3 WorkSpaces","description":"mypy-boto3-workspaces provides type annotations for the AWS WorkSpaces service client in the boto3 library. It enables static type checking with tools like MyPy, improving code quality and catching potential errors at development time. This package is generated by mypy-boto3-builder and its versioning is tied to the boto3 release cycle.","status":"active","version":"1.42.66","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","workspaces","stub","typing"],"install":[{"cmd":"pip install mypy-boto3-workspaces","lang":"bash","label":"Install package"}],"dependencies":[{"reason":"This package provides type stubs for the boto3 library, which must be installed separately for runtime functionality.","package":"boto3","optional":false},{"reason":"The primary tool for static type checking that consumes these stubs.","package":"mypy","optional":true}],"imports":[{"symbol":"WorkSpacesClient","correct":"from mypy_boto3_workspaces import WorkSpacesClient"},{"symbol":"WorkSpacesServiceName","correct":"from mypy_boto3_workspaces import WorkSpacesServiceName"},{"note":"Builder version 8.9.0 introduced breaking changes to TypedDict naming, often removing redundant 'Request' suffixes. Always check the exact type definition.","wrong":"from mypy_boto3_workspaces.type_defs import DescribeWorkspacesRequestTypeDef","symbol":"DescribeWorkspacesRequestRequestTypeDef","correct":"from mypy_boto3_workspaces.type_defs import DescribeWorkspacesRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_workspaces import WorkSpacesClient, WorkSpacesServiceName\nfrom mypy_boto3_workspaces.type_defs import DescribeWorkspacesRequestRequestTypeDef\n\ndef list_all_workspaces(client: WorkSpacesClient):\n    \"\"\"Lists all WorkSpaces with type hints.\"\"\"\n    print(\"Describing WorkSpaces...\")\n    paginator = client.get_paginator(\"describe_workspaces\")\n    all_workspaces = []\n    for page in paginator.paginate():\n        workspaces = page.get(\"Workspaces\", [])\n        all_workspaces.extend(workspaces)\n    print(f\"Found {len(all_workspaces)} WorkSpaces.\")\n    for ws in all_workspaces[:3]: # Print first 3 for brevity\n        print(f\"- {ws.get('WorkspaceId')} ({ws.get('State')})\")\n\nif __name__ == \"__main__\":\n    # Initialize a boto3 client for WorkSpaces\n    # The type hint here ensures MyPy checks usage against WorkSpacesClient stubs\n    workspaces_client: WorkSpacesClient = boto3.client(WorkSpacesServiceName.WORKSPACES)\n    list_all_workspaces(workspaces_client)\n","lang":"python","description":"This quickstart demonstrates how to use the `mypy-boto3-workspaces` stubs with a `boto3` client. It shows type-hinting a boto3 client object with `WorkSpacesClient` to enable static analysis for WorkSpaces operations."},"warnings":[{"fix":"Upgrade to Python 3.9 or newer.","message":"Python 3.8 is no longer supported. `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-workspaces` 1.42.66) removed support for Python 3.8 across all generated packages.","severity":"breaking","affected_versions":"mypy-boto3-workspaces >= 1.42.66, mypy-boto3-builder >= 8.12.0"},{"fix":"Ensure your `mypy` configuration (if customized) is compatible with standard PEP 561 package layouts. In most cases, this change should be transparent or improve stub discovery.","message":"Migration to PEP 561 compliant packages. `mypy-boto3-builder` 8.12.0 changed how these stub packages are structured for PEP 561 compliance. While generally beneficial for automatic discovery by type checkers, custom MyPy configurations might require adjustments.","severity":"breaking","affected_versions":"mypy-boto3-workspaces >= 1.42.66, mypy-boto3-builder >= 8.12.0"},{"fix":"Always ensure `boto3` is installed alongside `mypy-boto3-workspaces` (e.g., `pip install boto3 mypy-boto3-workspaces`).","message":"These packages provide only type stubs. They do not contain the runtime logic for AWS interactions. You must have `boto3` installed separately to use the AWS SDK functionality at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the specific service's generated `type_defs.pyi` for the exact new names of `TypedDict`s after upgrading. Your IDE's autocompletion should also help.","message":"TypedDict naming conventions changed in `mypy-boto3-builder` 8.9.0. This can lead to breaking changes for specific `TypedDict` names, for example, by removing redundant 'Request' suffixes (e.g., `FooRequestRequestTypeDef` might become `FooRequestTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0, mypy-boto3-workspaces >= 1.35.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}