Skip to content


Index > PI > Examples

Auto-generated documentation for PI type annotations stubs module mypy-boto3-pi.


Implicit type annotations#

Can be used with boto3-stubs[pi] package installed.

Write your PI code as usual, type checking and code completion should work out of the box.

# PIClient usage example

from boto3.session import Session

session = Session()

client = session.client("pi")  # (1)
result = client.create_performance_analysis_report()  # (2)
  1. client: PIClient
  2. result: CreatePerformanceAnalysisReportResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[pi] or a standalone mypy_boto3_pi package, you have to explicitly specify client: PIClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# PIClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_pi.client import PIClient
from mypy_boto3_pi.type_defs import CreatePerformanceAnalysisReportResponseTypeDef
from mypy_boto3_pi.type_defs import CreatePerformanceAnalysisReportRequestRequestTypeDef

session = Session()

client: PIClient = session.client("pi")

kwargs: CreatePerformanceAnalysisReportRequestRequestTypeDef = {...}
result: CreatePerformanceAnalysisReportResponseTypeDef = client.create_performance_analysis_report(**kwargs)