mypy-boto3-qbusiness Type Annotations
mypy-boto3-qbusiness provides type annotations for the `boto3` QBusiness service, generated by `mypy-boto3-builder`. It enhances code quality, readability, and error detection by enabling static type checking for `boto3` interactions with AWS QBusiness. The library is actively maintained with frequent updates to match `boto3` versions and `mypy-boto3-builder` releases, currently at version 1.42.14.
Warnings
- breaking Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0, which generates `mypy-boto3-qbusiness`. Projects relying on Python 3.8 will no longer receive updated type stubs.
- breaking As of `mypy-boto3-builder` version 8.9.0, there were breaking changes to TypeDef naming conventions. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. If upgrading from significantly older versions, review TypeDef usages.
- gotcha This package provides *type annotations* for `boto3`, not the `boto3` library itself. You must install `boto3` separately for your code to run.
- gotcha While `mypy-boto3` can offer auto-discovery for types, explicit type annotations for `boto3.client()` calls are often recommended, especially for VSCode users, to ensure optimal auto-completion and static checking.
Install
-
pip install mypy-boto3-qbusiness boto3 -
pip install mypy
Imports
- QBusinessClient
from mypy_boto3_qbusiness.client import QBusinessClient
- ListApplicationsOutputTypeDef
from mypy_boto3_qbusiness.type_defs import ListApplicationsOutputTypeDef
Quickstart
import boto3
from mypy_boto3_qbusiness.client import QBusinessClient
from typing import TYPE_CHECKING
# In a real application, you would configure AWS credentials.
# For a runnable example, we'll assume default config or environment variables.
# client: QBusinessClient = boto3.client('qbusiness') # Implicit typing for PyCharm / mypy
if TYPE_CHECKING:
client: QBusinessClient = boto3.client('qbusiness')
else:
client = boto3.client('qbusiness')
# Example: Listing QBusiness applications
# The return type can also be explicitly hinted if needed
response = client.list_applications()
print(f"QBusiness Applications: {response.get('applications', [])}")
# To run mypy, save this as a .py file and run `mypy your_file.py`