Type Annotations for Boto3 SsmSap
mypy-boto3-ssm-sap provides type annotations for the AWS Boto3 SsmSap (Systems Manager for SAP) service. It allows static type checkers like Mypy and IDEs to provide accurate auto-completion, error detection, and type hints for Boto3 calls related to SsmSap. This library is generated by mypy-boto3-builder and is updated regularly to reflect the latest Boto3 versions, currently at 1.42.13.
Warnings
- gotcha This package provides only type annotations, not the `boto3` runtime itself. You must install `boto3` (e.g., `pip install boto3`) for the code to execute at runtime. Without `boto3` installed, this package is effectively useless.
- breaking Support for Python 3.8 was removed starting with `mypy-boto3-builder` version 8.12.0. Packages generated with this builder version (including `mypy-boto3-ssm-sap` 1.42.13 and newer) will not work with Python 3.8.
- breaking In `mypy-boto3-builder` version 8.9.0, `TypeDef` naming conventions changed. This includes shortening packed method argument names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving `Extra` postfixes (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). This can break existing type hint usage.
- gotcha If using `mypy-boto3-builder` to generate custom stubs or installing `boto3-stubs-lite`, explicit type annotations for `boto3.session.client()` and `boto3.session.resource()` calls might be required. The standalone `mypy-boto3-ssm-sap` package generally provides implicit typing, but `lite` versions do not.
- gotcha When using Pylint, it might complain about undefined variables if `mypy-boto3` imports are conditional on `TYPE_CHECKING` and Pylint is not configured to understand these. This is a Pylint limitation, not a bug in the stubs.
Install
-
pip install mypy-boto3-ssm-sap boto3 -
pip install 'boto3-stubs[ssm-sap]' boto3
Imports
- SsmSapClient
from mypy_boto3_ssm_sap.client import SsmSapClient
- ListApplicationsPaginator
from mypy_boto3_ssm_sap.paginator import ListApplicationsPaginator
- SsmSapServiceResource
from mypy_boto3_ssm_sap.service_resource import SsmSapServiceResource
- ApplicationStatusType
from mypy_boto3_ssm_sap.literals import ApplicationStatusType
- ListApplicationsOutputTypeDef
from mypy_boto3_ssm_sap.type_defs import ListApplicationsOutputTypeDef
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_ssm_sap.client import SsmSapClient
from mypy_boto3_ssm_sap.paginator import ListApplicationsPaginator
def get_ssm_sap_client() -> 'SsmSapClient':
"""Returns a type-hinted Boto3 SsmSap client."""
# Boto3 client is implicitly typed by mypy-boto3-ssm-sap
return boto3.client("ssm-sap")
def list_all_applications(client: 'SsmSapClient'):
"""Lists all SsmSap applications using a paginator."""
paginator: 'ListApplicationsPaginator' = client.get_paginator("list_applications")
for page in paginator.paginate():
for app in page.get("Applications", []):
print(f"Application ID: {app.get('ApplicationId')}, Status: {app.get('Status')}")
# Example usage (requires AWS credentials configured for boto3)
if __name__ == "__main__":
ssm_sap_client = get_ssm_sap_client()
list_all_applications(ssm_sap_client)