mypy-boto3-workspaces-web type stubs
mypy-boto3-workspaces-web provides type annotations for the `boto3` WorkSpacesWeb service. It is part of the `mypy-boto3` family of packages, generated by `mypy-boto3-builder`. These stubs enhance developer experience with static type checking and IDE autocomplete for `boto3` clients. The current version is 1.42.51, reflecting the `boto3` version it types, and it follows a continuous release cadence in sync with `boto3` updates.
Warnings
- breaking Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0. This means `mypy-boto3-workspaces-web` generated with this builder version (and newer) will not support Python 3.8.
- breaking The `mypy-boto3` packages, including `mypy-boto3-workspaces-web`, migrated to PEP 561 packaging. While this improves discoverability, it might affect how older `mypy` versions or IDEs resolve stubs if not properly installed or configured.
- breaking TypeDef naming conventions were changed in `mypy-boto3-builder` 8.9.0. Some TypeDefs for packed method arguments or those with conflicting names were renamed (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `Extra` postfix moved to end).
- gotcha This package only provides type stubs. You *must* also install the `boto3` library for your application to run at runtime.
- gotcha For optimal performance and to avoid adding unnecessary runtime dependencies, it is a best practice to encapsulate `mypy-boto3` type imports within `if TYPE_CHECKING:` blocks.
Install
-
pip install mypy-boto3-workspaces-web boto3 mypy
Imports
- WorkSpacesWebClient
from mypy_boto3_workspaces_web.client import WorkSpacesWebClient
- WorkSpacesWebServiceName
from mypy_boto3_workspaces_web.literals import WorkSpacesWebServiceName
- AssociateBrowserSettingsRequestTypeDef
from mypy_boto3_workspaces_web.type_defs import AssociateBrowserSettingsRequestTypeDef
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_workspaces_web.client import WorkSpacesWebClient
from mypy_boto3_workspaces_web.type_defs import ListBrowserSettingsResponseTypeDef
def get_workspaces_web_client() -> 'WorkSpacesWebClient':
"""Returns a typed boto3 WorkSpacesWeb client."""
return boto3.client("workspaces-web")
def list_browser_settings_typed() -> ListBrowserSettingsResponseTypeDef:
"""Lists WorkSpaces Web browser settings with type hints."""
client: WorkSpacesWebClient = get_workspaces_web_client()
response = client.list_browser_settings()
print(f"Found {len(response.get('browserSettings', []))} browser settings.")
return response
if __name__ == "__main__":
# This part requires AWS credentials configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
# It will attempt to call the AWS API.
try:
list_browser_settings_typed()
except Exception as e:
print(f"An error occurred: {e}. Ensure AWS credentials are configured and WorkSpaces Web service is available.")