Skip to content

Examples#

Index > SavingsPlans > Examples

Auto-generated documentation for SavingsPlans type annotations stubs module mypy-boto3-savingsplans.

Client#

Implicit type annotations#

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

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

# SavingsPlansClient usage example

from boto3.session import Session


session = Session()

client = session.client("savingsplans")  # (1)
result = client.create_savings_plan()  # (2)
  1. client: SavingsPlansClient
  2. result: CreateSavingsPlanResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[savingsplans] or a standalone mypy_boto3_savingsplans package, you have to explicitly specify client: SavingsPlansClient 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.

# SavingsPlansClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_savingsplans.client import SavingsPlansClient
from mypy_boto3_savingsplans.type_defs import CreateSavingsPlanResponseTypeDef
from mypy_boto3_savingsplans.type_defs import CreateSavingsPlanRequestRequestTypeDef


session = Session()

client: SavingsPlansClient = session.client("savingsplans")

kwargs: CreateSavingsPlanRequestRequestTypeDef = {...}
result: CreateSavingsPlanResponseTypeDef = client.create_savings_plan(**kwargs)