{"id":3123,"library":"mypy-boto3-pricing","title":"mypy-boto3-pricing Type Stubs","description":"mypy-boto3-pricing provides static type annotations for the `boto3` AWS Pricing service, enhancing development with type checking and IDE autocompletion. It is currently at version 1.42.82, aligning with its corresponding `boto3` version. This package is part of the `mypy-boto3` ecosystem, which automatically generates and releases stubs for all `boto3` services in sync with upstream AWS SDK updates.","status":"active","version":"1.42.82","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type hints","type stubs","pricing"],"install":[{"cmd":"pip install mypy-boto3-pricing boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"This package provides type stubs for the `boto3` library; `boto3` itself is required for runtime functionality.","package":"boto3","optional":false}],"imports":[{"note":"Used for explicit type annotation of the boto3 Pricing client.","symbol":"PricingClient","correct":"from mypy_boto3_pricing import PricingClient"},{"note":"For explicit type annotation of paginators.","symbol":"DescribeServicesPaginator","correct":"from mypy_boto3_pricing.paginator import DescribeServicesPaginator"},{"note":"For explicit type annotation of service-specific TypedDicts.","symbol":"AttributeValueTypeDef","correct":"from mypy_boto3_pricing.type_defs import AttributeValueTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_pricing import PricingClient\n    from mypy_boto3_pricing.type_defs import GetProductsOutputTypeDef\n\n    client: PricingClient = boto3.client(\"pricing\")\n\n    response: GetProductsOutputTypeDef = client.get_products(\n        ServiceCode=\"AmazonEC2\",\n        Filters=[\n            {\"Type\": \"TERM_MATCH\", \"Field\": \"operatingSystem\", \"Value\": \"Linux\"}\n        ],\n    )\n\n    for price_list in response.get(\"PriceList\", []):\n        print(price_list)\n\nelse:\n    client = boto3.client(\"pricing\")\n    # In a non-type-checking environment, type annotations are stripped.\n    # The actual boto3 client is used directly.\n    response = client.get_products(\n        ServiceCode=\"AmazonEC2\",\n        Filters=[\n            {\"Type\": \"TERM_MATCH\", \"Field\": \"operatingSystem\", \"Value\": \"Linux\"}\n        ],\n    )\n    for price_list in response.get(\"PriceList\", []):\n        print(price_list)","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your project's Python version to 3.9 or higher, or pin `mypy-boto3-pricing` to an older version compatible with Python 3.8.","message":"Version 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]","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (mypy-boto3-pricing versions generated by it)"},{"fix":"Update your code to use the new TypeDef names. Consult the specific service's documentation or generated stub files for the correct names.","message":"Breaking 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]","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (mypy-boto3-pricing versions generated by it)"},{"fix":"Consider `pip install boto3-stubs-lite[pricing]` or configure PyCharm to use `mypy` or `pyright` for type checking, disabling its native checker for improved performance.","message":"PyCharm 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`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Add explicit type annotations, for example: `client: PricingClient = session.client(\"pricing\")`.","message":"While `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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"In the `else` block (for runtime), assign `object` to the type-annotated variables, e.g., `else: PricingClient = object`.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}