API Reference

Core Module

Core functionality for botowrap extensions.

Provides base classes and managers for extending boto3 clients.

class botowrap.core.BaseExtension[source]

Bases: object

Base class for all client-extension wrappers.

Subclasses must implement attach(session) and detach(session).

attach(session: Session) None[source]

Attach this extension to the given boto3 session.

detach(session: Session) None[source]

Detach this extension from the given boto3 session.

class botowrap.core.ExtensionManager(session: Session | None = None)[source]

Bases: object

Holds and bootstraps a collection of BaseExtension instances.

Initialize with an optional boto3 session.

__init__(session: Session | None = None)[source]

Initialize with an optional boto3 session.

register(ext: BaseExtension) None[source]

Add an extension to be bootstrapped.

bootstrap() None[source]

Attach all registered extensions to the session.

teardown() None[source]

Detach all registered extensions (e.g. for tests).

DynamoDB Extension

DynamoDB extension for botowrap.

Provides enhanced DynamoDB client functionality with automatic serialization/deserialization, timestamp management, pagination helpers, and retry logic.

class botowrap.extensions.dynamodb.DynamoDBConfig(max_retries: int = 5, log_consumed: bool = True, add_pagination: bool = True, add_timestamps: bool = True)[source]

Bases: object

Configuration options for the DynamoDB extension.

max_retries: int = 5
log_consumed: bool = True
add_pagination: bool = True
add_timestamps: bool = True
class botowrap.extensions.dynamodb.DynamoDBExtension(config: DynamoDBConfig)[source]

Bases: BaseExtension

Attaches all DynamoDB “document client” behavior onto boto3.client(‘dynamodb’).

Initialize DynamoDB extension with the given configuration.

Args:

config: Configuration options for the DynamoDB extension

SERVICE = 'dynamodb'
__init__(config: DynamoDBConfig) None[source]

Initialize DynamoDB extension with the given configuration.

Args:

config: Configuration options for the DynamoDB extension

attach(session: Session) None[source]

Attach the DynamoDB extension to the given session.

Registers event handlers to add document client functionality to DynamoDB clients created from this session.

Args:

session: The boto3 session to attach to

detach(session: Session) None[source]

Detach the DynamoDB extension from the given session.

Args:

session: The boto3 session to detach from

class botowrap.extensions.dynamodb.DynamoDBDocumentClient(client: BaseClient)[source]

Bases: object

DynamoDB document client wrapper.

This class wraps a botocore DynamoDB client to provide document-style operations. It handles serialization and deserialization of Python types to/from DynamoDB’s AttributeValue format, adds pagination helpers, automatic retries for throttling, and optional features like timestamp injection and capacity logging.

The wrapper is automatically attached to new DynamoDB client instances via the _DocumentClientBootstrapper mixin.

Attributes

client: The underlying botocore DynamoDB client serializer: TypeSerializer for converting Python types to DynamoDB format deserializer: TypeDeserializer for converting DynamoDB format to Python types config: Configuration options for the DynamoDB extension

Initialize DynamoDB document client wrapper.

Args:

client: The DynamoDB client to wrap

__init__(client: BaseClient) None[source]

Initialize DynamoDB document client wrapper.

Args:

client: The DynamoDB client to wrap