mypy-boto3-taxsettings: Type Annotations for AWS TaxSettings
mypy-boto3-taxsettings provides comprehensive type annotations for the AWS boto3 TaxSettings service, enabling robust static type checking with tools like MyPy, PyRight, VSCode, and PyCharm. It is currently at version 1.42.3, generated by `mypy-boto3-builder` 8.12.0, and is actively maintained with frequent updates that typically follow boto3 releases.
Warnings
- breaking Python 3.8 support has been removed. All `mypy-boto3` packages, including `mypy-boto3-taxsettings`, now require Python 3.9 or newer.
- gotcha This package provides only type stubs. The actual `boto3` library must be installed separately in your environment for the code to run at runtime.
- gotcha It is best practice to wrap type-only imports (e.g., `TaxSettingsClient`, `TypeDefs`) within an `if TYPE_CHECKING:` block to prevent potential runtime import errors or circular dependencies and improve runtime performance.
- breaking The `mypy-boto3-builder` version 8.9.0 introduced breaking changes to `TypeDef` naming conventions (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). If you are explicitly referencing `TypeDef` names from older `mypy-boto3` versions, these may have changed.
- gotcha PyCharm's built-in type checker may experience slow performance with Literal overloads. For better performance, consider using `boto3-stubs-lite` or configuring PyCharm to use `mypy` or `pyright` as its type checker.
Install
-
pip install mypy-boto3-taxsettings boto3 -
pip install 'boto3-stubs[taxsettings]' boto3
Imports
- TaxSettingsClient
from mypy_boto3_taxsettings.client import TaxSettingsClient
- AccountDetailsTypeDef
from mypy_boto3_taxsettings.type_defs import AccountDetailsTypeDef
Quickstart
from typing import TYPE_CHECKING
import boto3
if TYPE_CHECKING:
from mypy_boto3_taxsettings.client import TaxSettingsClient
from mypy_boto3_taxsettings.type_defs import GetTaxRegistrationOutputTypeDef
def get_tax_registration_details(region: str) -> 'GetTaxRegistrationOutputTypeDef':
client: TaxSettingsClient = boto3.client("taxsettings", region_name=region)
response = client.get_tax_registration()
print(response)
return response
if __name__ == "__main__":
# Replace 'us-east-1' with your desired AWS region
# ensure your AWS credentials are configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY env vars or ~/.aws/credentials)
try:
tax_details = get_tax_registration_details("us-east-1")
print(f"Successfully retrieved tax registration details: {tax_details}")
except Exception as e:
print(f"Error retrieving tax registration details: {e}")