mypy-boto3-marketplace-reporting Type Stubs
Type annotations for boto3's MarketplaceReportingService. This package, part of the `mypy-boto3` ecosystem, provides static type checking for AWS SDK for Python (boto3) clients, resources, and their associated data structures. It helps improve code quality by enabling IDE autocomplete and early error detection for `MarketplaceReportingService` operations. It is regularly updated to match `boto3` releases and requires Python >= 3.9.
Warnings
- breaking Support for Python 3.8 was removed from `mypy-boto3-builder` (version 8.12.0 onwards), impacting all generated `mypy-boto3` stub packages. Projects requiring Python 3.8 should use an older version of `mypy-boto3` stubs or upgrade their Python version.
- breaking TypeDef naming conventions changed in `mypy-boto3-builder` (version 8.9.0), affecting all generated stub packages. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. Existing code explicitly importing these verbose TypeDef names might break.
- gotcha This package provides only type annotations (`.pyi` files) for `boto3`. It does not include the `boto3` runtime library itself. You must install `boto3` separately to use the AWS SDK functionality at runtime.
- gotcha When using `TYPE_CHECKING` for conditional imports (as in the quickstart), Pylint may report `undefined-variable` errors for the conditionally imported types. This is a known issue with Pylint's static analysis.
Install
-
pip install mypy-boto3-marketplace-reporting
Imports
- MarketplaceReportingClient
from mypy_boto3_marketplace_reporting.client import MarketplaceReportingClient
- ListEntitlementsOutputTypeDef
from mypy_boto3_marketplace_reporting.type_defs import ListEntitlementsOutputTypeDef
Quickstart
from typing import TYPE_CHECKING
import boto3
if TYPE_CHECKING:
from mypy_boto3_marketplace_reporting.client import MarketplaceReportingClient
from mypy_boto3_marketplace_reporting.type_defs import ListEntitlementsOutputTypeDef
def get_marketplace_reporting_client() -> 'MarketplaceReportingClient':
"""Gets a typed Marketplace Reporting Service client."""
# boto3 client creation without type hint (type checkers will infer via stubs)
client = boto3.client('marketplace-reporting')
return client # type: ignore
client: MarketplaceReportingClient = get_marketplace_reporting_client()
# Example usage: List entitlements with type-hinted response
# Replace 'YOUR_PRODUCT_CODE' with an actual AWS Marketplace Product Code
try:
response: ListEntitlementsOutputTypeDef = client.list_entitlements(
ProductCode='YOUR_PRODUCT_CODE',
MaxResults=5
)
print("Successfully listed entitlements:")
for entitlement in response.get('Entitlements', []):
print(f" Entitlement ID: {entitlement.get('EntitlementId')}")
if response.get('NextToken'):
print(f" NextToken: {response['NextToken']}")
except client.exceptions.ClientError as e:
print(f"Error listing entitlements: {e}")