Skip to content

Examples#

Index > Amplify > Examples

Auto-generated documentation for Amplify type annotations stubs module mypy-boto3-amplify.

Client#

Implicit type annotations#

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

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

# AmplifyClient usage example

from boto3.session import Session


session = Session()

client = session.client("amplify")  # (1)
result = client.create_app()  # (2)
  1. client: AmplifyClient
  2. result: CreateAppResultTypeDef
# ListAppsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("amplify")  # (1)

paginator = client.get_paginator("list_apps")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AmplifyClient
  2. paginator: ListAppsPaginator
  3. item: ListAppsResultTypeDef

Explicit type annotations#

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

# AmplifyClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_amplify.client import AmplifyClient
from mypy_boto3_amplify.type_defs import CreateAppResultTypeDef
from mypy_boto3_amplify.type_defs import CreateAppRequestRequestTypeDef


session = Session()

client: AmplifyClient = session.client("amplify")

kwargs: CreateAppRequestRequestTypeDef = {...}
result: CreateAppResultTypeDef = client.create_app(**kwargs)
# ListAppsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_amplify.client import AmplifyClient
from mypy_boto3_amplify.paginator import ListAppsPaginator
from mypy_boto3_amplify.type_defs import ListAppsResultTypeDef


session = Session()
client: AmplifyClient = session.client("amplify")

paginator: ListAppsPaginator = client.get_paginator("list_apps")
for item in paginator.paginate(...):
    item: ListAppsResultTypeDef
    print(item)