Install & Compatibility
Where this runs
tested against v1.43.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.566s · 51.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 0.556s · 52MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PricingClient
✓ from mypy_boto3_pricing import PricingClient
Used for explicit type annotation of the boto3 Pricing client.
DescribeServicesPaginator
✓ from mypy_boto3_pricing.paginator import DescribeServicesPaginator
For explicit type annotation of paginators.
AttributeValueTypeDef
✓ from mypy_boto3_pricing.type_defs import AttributeValueTypeDef
For explicit type annotation of service-specific TypedDicts.
This quickstart demonstrates how to initialize a `boto3` Pricing client with type annotations using `mypy-boto3-pricing`. The `TYPE_CHECKING` block allows type checkers to validate your code while avoiding runtime dependencies on `mypy-boto3-pricing` in production. It then calls `get_products` to retrieve pricing information for Amazon EC2 instances running Linux.
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_pricing import PricingClient
from mypy_boto3_pricing.type_defs import GetProductsOutputTypeDef
client: PricingClient = boto3.client("pricing")
response: GetProductsOutputTypeDef = client.get_products(
ServiceCode="AmazonEC2",
Filters=[
{"Type": "TERM_MATCH", "Field": "operatingSystem", "Value": "Linux"}
],
)
for price_list in response.get("PriceList", []):
print(price_list)
else:
client = boto3.client("pricing")
# In a non-type-checking environment, type annotations are stripped.
# The actual boto3 client is used directly.
response = client.get_products(
ServiceCode="AmazonEC2",
Filters=[
{"Type": "TERM_MATCH", "Field": "operatingSystem", "Value": "Linux"}
],
)
for price_list in response.get("PriceList", []):
print(price_list)
Debug
Known issues
breakingVersion 8.12.0 of `mypy-boto3-builder` (which generates these stubs) removed support for Python 3.8 across all `mypy-boto3` packages. Projects targeting Python 3.8 must use an older version of `mypy-boto3-pricing` or upgrade to Python 3.9 or newer. [cite: 8.12.0 release notes]fixUpgrade your project's Python version to 3.9 or higher, or pin `mypy-boto3-pricing` to an older version compatible with Python 3.8.
affects: mypy-boto3-builder >= 8.12.0 (mypy-boto3-pricing versions generated by it)
breakingBreaking changes in TypeDef naming conventions were introduced in `mypy-boto3-builder` 8.9.0. Some TypeDefs for method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting TypeDef `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`). If you explicitly reference these TypeDef names, your code may break. [cite: 8.9.0 release notes, 3]fixUpdate your code to use the new TypeDef names. Consult the specific service's documentation or generated stub files for the correct names.
affects: mypy-boto3-builder >= 8.9.0 (mypy-boto3-pricing versions generated by it)
gotchaPyCharm users might experience slow performance and high CPU usage due to `Literal` overloads. It is recommended to use `boto3-stubs-lite` (if available for the service) or disable PyCharm's internal type checker and rely on external tools like `mypy` or `pyright`.fixConsider `pip install boto3-stubs-lite[pricing]` or configure PyCharm to use `mypy` or `pyright` for type checking, disabling its native checker for improved performance.
affects: All versions
gotchaWhile `mypy` and PyCharm often infer types correctly, VSCode users may need to provide explicit type annotations for `boto3.client`, `boto3.session.client`, `client.get_waiter`, and `client.get_paginator` calls to ensure full code autocompletion and correct type hints.fixAdd explicit type annotations, for example: `client: PricingClient = session.client("pricing")`. affects: All versions
gotchaWhen using `typing.TYPE_CHECKING` to conditionally import type stubs and avoid production dependencies, Pylint may report 'undefined variable' errors for the type-annotated objects in the runtime block.fixIn the `else` block (for runtime), assign `object` to the type-annotated variables, e.g., `else: PricingClient = object`.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for the `boto3` library; `boto3` itself is required for runtime functionality.