mypy-boto3-bcm-data-exports Type Annotations
mypy-boto3-bcm-data-exports provides a set of type annotations for the `boto3` AWS SDK, specifically for the Billing and Cost Management Data Exports (BCM Data Exports) service. These annotations enhance code completion, static analysis, and type checking for `boto3` users with tools like MyPy, VSCode, and PyCharm. The library is currently at version 1.42.77 and is released frequently, typically in sync with `boto3` and `botocore` updates.
Warnings
- breaking Python 3.8 support has been officially removed for all `mypy-boto3` packages. Projects targeting Python 3.8 must use older versions of `mypy-boto3` or `mypy-boto3-builder`.
- breaking All `mypy-boto3` packages, including `mypy-boto3-bcm-data-exports`, have migrated to PEP 561 `py.typed` packages. This changes how type checkers discover stubs and might require updates to your `mypy` configuration or import paths if you were relying on older, non-PEP 561 compatible patterns.
- breaking TypeDef naming conventions were changed, potentially affecting custom code that directly imports or references generated `TypedDict` names. For example, some 'RequestRequestTypeDef' names were shortened, and 'Extra' postfixes were moved.
- gotcha Explicit type annotations are highly recommended (and sometimes required, e.g., for `lite` versions) for `boto3.client()` and `boto3.resource()` calls to fully leverage `mypy-boto3` type checking and IDE autocomplete.
- gotcha `mypy-boto3-bcm-data-exports` provides *type annotations* only; it does not include `boto3` itself. `boto3` must be installed separately for your application to run.
- gotcha The `mypy-boto3` packages are generated for specific `boto3` versions. To ensure correct type checking, it is crucial to keep your `mypy-boto3-bcm-data-exports` package version synchronized with your installed `boto3` runtime version.
Install
-
pip install mypy-boto3-bcm-data-exports -
pip install boto3-stubs[bcm-data-exports]
Imports
- BCMDataExportsClient
from mypy_boto3_bcm_data_exports.client import BCMDataExportsClient
- BCMDataExportsServiceResource
from mypy_boto3_bcm_data_exports.service_resource import BCMDataExportsServiceResource
- CreateExportRequestRequestTypeDef
from mypy_boto3_bcm_data_exports.type_defs import CreateExportRequestRequestTypeDef
Quickstart
import boto3
from mypy_boto3_bcm_data_exports.client import BCMDataExportsClient
def get_bcm_data_exports_client() -> BCMDataExportsClient:
"""Returns a type-hinted BCM Data Exports client."""
client: BCMDataExportsClient = boto3.client(
"bcm-data-exports",
region_name="us-east-1",
aws_access_key_id="{}".format(os.environ.get('AWS_ACCESS_KEY_ID', '')),
aws_secret_access_key="{}".format(os.environ.get('AWS_SECRET_ACCESS_KEY', '')),
)
return client
# Example usage:
if __name__ == "__main__":
import os
client = get_bcm_data_exports_client()
# You can now use 'client' with full type hints and autocomplete
# For example, to list exports:
try:
response = client.list_exports()
print("Successfully listed BCM Data Exports:")
for export in response.get('Exports', []):
print(f" - {export.get('ExportArn')}")
except Exception as e:
print(f"Error listing exports: {e}")