Skip to content

Examples#

Index > Mobile > Examples

Auto-generated documentation for Mobile type annotations stubs module mypy-boto3-mobile.

Client#

Implicit type annotations#

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

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

# MobileClient usage example

from boto3.session import Session


session = Session()

client = session.client("mobile")  # (1)
result = client.create_project()  # (2)
  1. client: MobileClient
  2. result: CreateProjectResultTypeDef
# ListBundlesPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_bundles")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: MobileClient
  2. paginator: ListBundlesPaginator
  3. item: ListBundlesResultTypeDef

Explicit type annotations#

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

# MobileClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_mobile.client import MobileClient
from mypy_boto3_mobile.type_defs import CreateProjectResultTypeDef
from mypy_boto3_mobile.type_defs import CreateProjectRequestRequestTypeDef


session = Session()

client: MobileClient = session.client("mobile")

kwargs: CreateProjectRequestRequestTypeDef = {...}
result: CreateProjectResultTypeDef = client.create_project(**kwargs)
# ListBundlesPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_mobile.client import MobileClient
from mypy_boto3_mobile.paginator import ListBundlesPaginator
from mypy_boto3_mobile.type_defs import ListBundlesResultTypeDef


session = Session()
client: MobileClient = session.client("mobile")

paginator: ListBundlesPaginator = client.get_paginator("list_bundles")
for item in paginator.paginate(...):
    item: ListBundlesResultTypeDef
    print(item)