mypy-boto3-qbusiness Type Annotations

1.42.14 · active · verified Sat Apr 11

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

Install

Imports

Quickstart

This quickstart demonstrates how to use `mypy-boto3-qbusiness` to type-hint a `boto3` QBusiness client. It shows the import of the `QBusinessClient` type and its application to the `boto3.client` call, enabling static analysis tools like MyPy and IDEs to provide accurate auto-completion and type checking. While some IDEs (like PyCharm) and MyPy can infer types, explicit annotation with `TYPE_CHECKING` is generally recommended for broader compatibility, especially with tools like VSCode.

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`

view raw JSON →