mypy-boto3-partnercentral-channel type stubs
mypy-boto3-partnercentral-channel provides type annotations for the boto3 PartnerCentralChannel API, allowing for static type checking of your AWS client interactions. It is a generated package, part of the wider `mypy-boto3` ecosystem, and its version typically aligns with the `boto3` version it provides stubs for. The `mypy-boto3-builder` project maintains a frequent release cadence, often daily or weekly, to keep up with `boto3` updates and add new features/fixes to the type stubs.
Warnings
- breaking Python 3.8 support has been dropped for packages generated by `mypy-boto3-builder` version 8.12.0 and later. If you are using `mypy-boto3-partnercentral-channel` version 1.42.60 or newer, you must use Python 3.9 or higher.
- breaking TypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. Specifically, argument TypeDefs were shortened, and 'Extra' postfixes were moved. This might cause import errors or incorrect type references if your code explicitly imports specific TypeDefs from `mypy_boto3_partnercentral_channel.type_defs`.
- gotcha These packages provide type stubs only. They do not contain any runtime code and must be used alongside the actual `boto3` library. Installing `mypy-boto3-partnercentral-channel` without `boto3` will result in runtime errors.
- gotcha The `mypy-boto3` ecosystem migrated to PEP 561-compliant packages. While this generally improves compatibility with type checkers, in rare cases with older MyPy versions or unusual project setups, you might need to ensure your type checker correctly discovers these stubs.
Install
-
pip install mypy-boto3-partnercentral-channel boto3
Imports
- PartnerCentralChannelClient
from mypy_boto3_partnercentral_channel.client import PartnerCentralChannelClient
- Client
from mypy_boto3_partnercentral_channel.client import PartnerCentralChannelClient as Client
- ListChannelsResponseTypeDef
from mypy_boto3_partnercentral_channel.type_defs import ListChannelsResponseTypeDef
Quickstart
import boto3
import os
from mypy_boto3_partnercentral_channel.client import PartnerCentralChannelClient
from mypy_boto3_partnercentral_channel.type_defs import ListChannelsResponseTypeDef
# Create a boto3 client with type hints
# AWS credentials are typically managed by environment variables, shared credential file, or IAM roles.
# For explicit region, use os.environ.get.
region = os.environ.get('AWS_REGION', 'us-east-1')
session = boto3.Session(region_name=region)
# The client variable is type-hinted for autocompletion and static analysis
client: PartnerCentralChannelClient = session.client("partnercentral-channel")
try:
# Use the client with type-hinted response
response: ListChannelsResponseTypeDef = client.list_channels()
print(f"Successfully listed channels in {region}:")
for channel in response.get("Channels", []):
print(f" - ID: {channel['ChannelId']}, Name: {channel['ChannelName']}")
except Exception as e:
print(f"Error listing Partner Central channels: {e}")