mypy-boto3-partnercentral-benefits
mypy-boto3-partnercentral-benefits provides comprehensive type annotations for the `boto3` PartnerCentralBenefits service. It enhances development with static type checking and improved autocomplete in IDEs for `boto3` clients, paginators, and specific type definitions. Part of the `mypy-boto3-builder` project, this library is frequently updated to stay synchronized with `boto3` releases. The current version is 1.42.3.
Warnings
- breaking Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0 and later, affecting all generated `mypy-boto3` stub packages. This package (1.42.3) requires Python 3.9 or newer.
- breaking Migration to PEP 561-compliant packages occurred in `mypy-boto3-builder` 8.12.0. While this generally improves type checker discovery, users with highly customized build systems or older `mypy` versions might need to verify compatibility.
- breaking TypeDef naming conventions were changed in `mypy-boto3-builder` 8.9.0. This includes shorter names for packed method arguments (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving 'Extra' postfixes (`CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). Code explicitly importing or referencing these TypeDefs will break.
- gotcha This package provides only type annotations. `boto3` (the actual AWS SDK for Python) must be installed separately for your code to function at runtime. Ensure `boto3` is installed and its version is compatible with the stubs.
- gotcha PyCharm users might experience slow performance or high CPU usage due to `Literal` overloads (PyCharm issue PY-40997). The `mypy-boto3` project recommends using `boto3-stubs-lite` packages or disabling PyCharm's type checker and relying on `mypy` or `pyright` instead.
Install
-
pip install mypy-boto3-partnercentral-benefits boto3
Imports
- PartnerCentralBenefitsClient
from mypy_boto3_partnercentral_benefits.client import PartnerCentralBenefitsClient
- ListPartnerBenefitsResponseTypeDef
from mypy_boto3_partnercentral_benefits.type_defs import ListPartnerBenefitsResponseTypeDef
- PartnerCentralBenefitsServiceName
from mypy_boto3_partnercentral_benefits.literals import PartnerCentralBenefitsServiceName
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_partnercentral_benefits.client import PartnerCentralBenefitsClient
def get_benefits_summary():
# The stubs provide type hints; boto3 itself performs the AWS API calls.
client: PartnerCentralBenefitsClient = boto3.client(
"partnercentral-benefits",
region_name="us-east-1",
aws_access_key_id="test", # Replace with actual credentials or env vars
aws_secret_access_key="test"
)
try:
response = client.list_partner_benefits(MaxResults=10)
print("Successfully listed partner benefits.")
for benefit in response.get("PartnerBenefitSummaries", []):
print(f"- Benefit ID: {benefit.get('BenefitId')}, Status: {benefit.get('Status')}")
except Exception as e:
print(f"Error listing partner benefits: {e}")
if __name__ == "__main__":
get_benefits_summary()