Install & Compatibility
Where this runs
tested against v1.43.62 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.606s · 51.9MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 4.3s · import 0.558s · 52MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BillingClient
✓ from mypy_boto3_billing.client import BillingClient
ListAccountGroupsOutputTypeDef
✓ from mypy_boto3_billing.type_defs import ListAccountGroupsOutputTypeDef
This quickstart demonstrates how to initialize a boto3 Billing client with type annotations from `mypy-boto3-billing` and make a simple API call. It correctly hints the `client` variable for static analysis.
import boto3
from mypy_boto3_billing.client import BillingClient
import os
# Ensure AWS credentials are set up (e.g., via environment variables or ~/.aws/credentials)
# For a runnable example, we'll use dummy credentials if not found
os.environ.setdefault('AWS_ACCESS_KEY_ID', 'test')
os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'test')
os.environ.setdefault('AWS_SESSION_TOKEN', 'test')
os.environ.setdefault('AWS_DEFAULT_REGION', 'us-east-1')
def get_billing_summary():
client: BillingClient = boto3.client('billing')
try:
response = client.list_billing_groups(
Filters={'And': [{'AttributeValue': 'active', 'AttributeName': 'Status'}]},
MaxResults=5
)
print("Successfully retrieved billing groups summary.")
for group in response.get('BillingGroups', []):
print(f" Billing Group ARN: {group.get('Arn')}, Name: {group.get('Name')}")
except Exception as e:
print(f"Error retrieving billing groups: {e}")
if __name__ == '__main__':
get_billing_summary()
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0, Python 3.8 is no longer supported across all generated `mypy-boto3` packages, including `mypy-boto3-billing`. Projects using these stubs must upgrade to Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or higher. Ensure your `pyproject.toml` or `setup.py` reflects this change.
affects: mypy-boto3-billing >= 1.42.x (generated by builder 8.12.0+)
breakingType Definition (TypeDef) names for service operations were shortened, and the `Extra` postfix for conflicting names was moved in `mypy-boto3-builder` version 8.9.0. While `billing` specific changes might be minimal, this is a general breaking change in the naming convention of generated types.fixReview your code for any direct references to TypeDef names. Update them according to the new naming conventions if they were affected (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).
affects: mypy-boto3-billing >= 1.42.x (generated by builder 8.9.0+)
gotchaTo get full type checking benefits, you must explicitly annotate the boto3 client with the type from `mypy_boto3_billing.client`. Without `client: BillingClient = ...`, mypy will only see the untyped `boto3` client.fixAlways add a type hint when initializing the boto3 client, e.g., `client: BillingClient = boto3.client('billing')`. affects: All versions
gotchaUsing an older `boto3` version than what the stubs were generated for can lead to mismatches and type checking errors, as the API might have evolved.fixKeep `boto3` and `mypy-boto3-billing` versions synchronized as much as possible. It's often best to upgrade both together.
affects: All versions
Upgrade
Version history
1.43.62latest on PyPI · released Jul 31, 2026
Audit
Dependencies
boto3requiredRequired for runtime AWS SDK functionality.
mypyoptionalRequired for static type checking.
types-boto3optionalAlternative to installing individual service stubs; provides stubs for all services.