mypy-boto3-partnercentral-selling Type Annotations
mypy-boto3-partnercentral-selling provides type annotations for the `boto3` PartnerCentralSellingAPI service. It enables static type checking for `boto3` client calls, methods, and responses, enhancing code reliability and developer experience. The current version is 1.42.80, and it is frequently updated to align with `boto3` and AWS API changes.
Warnings
- breaking As of `mypy-boto3-builder` version 8.12.0, support for Python 3.8 has been removed across all `mypy-boto3` packages, including `mypy-boto3-partnercentral-selling`.
- gotcha The `mypy-boto3-*` packages provide *only* type annotations. You must have the `boto3` library itself installed for runtime functionality. They are not a replacement for `boto3`.
- gotcha It is crucial to keep your `mypy-boto3-*` stub packages in sync with your `boto3` library version. Mismatched versions can lead to incorrect type hints or `mypy` errors if API definitions have changed.
- breaking Starting with `mypy-boto3-builder` 8.9.0, some generated `TypeDef` names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) or had conflicting postfixes moved (`CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). While `partnercentral-selling` might not be directly affected by these *specific* examples, be aware that explicit imports of `TypeDef` objects might require updates.
- gotcha As of `mypy-boto3-builder` 8.12.0, all packages migrated to PEP 561-compliant distribution. This means the type information is now directly within the installed package structure. While generally beneficial, older type checkers or unusual import configurations might need adjustment.
Install
-
pip install boto3 mypy-boto3-partnercentral-selling
Imports
- PartnerCentralSellingAPIClient
from mypy_boto3_partnercentral_selling.client import PartnerCentralSellingAPIClient
- ServiceResource
from mypy_boto3_partnercentral_selling.service_resource import PartnerCentralSellingAPIResource
Quickstart
import boto3
from mypy_boto3_partnercentral_selling.client import PartnerCentralSellingAPIClient
from typing import TYPE_CHECKING
# Recommended: Use TYPE_CHECKING for imports only used by type checkers
if TYPE_CHECKING:
# Only import if you need specific TypeDefs for complex scenarios
from mypy_boto3_partnercentral_selling.type_defs import GetPartnerAccountOutputTypeDef
def get_partnercentral_selling_client() -> PartnerCentralSellingAPIClient:
# boto3.client returns the actual client, which is type-checked by mypy-boto3-*
return boto3.client("partnercentral-selling")
client: PartnerCentralSellingAPIClient = get_partnercentral_selling_client()
try:
# Example API call with type-hinted client
# Replace 'YOUR_PARTNER_ACCOUNT_ID' with a real one for a runnable example
response = client.get_partner_account(partnerAccountId=os.environ.get('PARTNER_ACCOUNT_ID', 'YOUR_PARTNER_ACCOUNT_ID'))
print(f"Partner account name: {response.get('partnerAccountName')}")
print(f"Account status: {response.get('accountStatus')}")
except client.exceptions.ResourceNotFoundException:
print("Partner account not found.")
except Exception as e:
print(f"An error occurred: {e}")