Skip to main content

dynamoxy

A typed, async DynamoDB ORM for Python, with a Rust core. Declare models with type hints (or pydantic), and get validated, atomic, observable DynamoDB access: repositories, queries with cursors, transactions with readable failures, unique constraints, optimistic locking, single-table design and an in-memory DynamoDB for tests.

import asyncio
from datetime import datetime

import dynamoxy
from dynamoxy import Attr, field, partition_key


class User(dynamoxy.Model, table="users"):
    user_id: Attr[str] = partition_key()
    email: Attr[str] = field(unique=True)
    name: Attr[str] = field(min_length=1)
    visits: Attr[int] = field(default=0)
    created_at: Attr[datetime] = dynamoxy.created_at()
    version: Attr[int] = dynamoxy.version()

    by_email = dynamoxy.GlobalIndex(partition_key=email)


async def main() -> None:
    async with dynamoxy.Client(region="eu-west-1") as client:  # or dynamoxy.testing.memory_client()
        await client.ensure_tables(User)
        users = client.repository(User)

        ada = await users.create(User(user_id="u1", email="ada@example.com", name="Ada"))
        await ada.increment(User.visits)  # atomic; `ada` is refreshed in place
        ada.name = "Ada Lovelace"
        await ada.save()  # only if nobody changed it meanwhile (version)

        try:
            await users.create(User(user_id="u2", email="ada@example.com", name="Imposter"))
        except dynamoxy.UniqueConstraintError as error:
            print(f"{error.field} is taken")

        found = await users.query(index=User.by_email, email="ada@example.com").first()
        print(found)


asyncio.run(main())

Already using pydantic?

Inherit from dynamoxy.PydanticModel instead of BaseModel and mark the key. Pydantic keeps validating, and the class stays a pydantic model, so the same Customer can be a FastAPI request or response model and a DynamoDB table (uv add 'dynamoxy[pydantic]'):

from typing import Annotated

from pydantic import BaseModel, Field

import dynamoxy


class Address(BaseModel):  # plain pydantic models nest as maps
    street: str
    city: str


class Customer(dynamoxy.PydanticModel, table="customers"):  # instead of BaseModel
    customer_id: Annotated[str, dynamoxy.PartitionKey()]
    email: Annotated[str, dynamoxy.Unique()]
    name: str = Field(min_length=1)
    address: Address | None = None


await client.ensure_tables(Customer)
customers = client.repository(Customer)
await customers.create(Customer(customer_id="c1", email="ada@example.com", name="Ada"))
customer = await customers.get("c1")  # a validated Customer

A model you would rather not touch can stay as it is: subclass it together with dynamoxy.PydanticModel and re-declare only the fields that need a marker, such as the key (see the pydantic guide).

Why dynamoxy

  • Typed models: Attr[T] fields are values on instances and typed expression paths on the class (User.visits > 3); type checkers understand constructors and expressions. Pydantic models work too.
  • Correct by default: validation before I/O, create that never overwrites, optimistic locking with version(), unique attributes enforced transactionally, automatic timestamps, conditions on every write, no values in expression strings.
  • Every DynamoDB feature: queries and scans with cursors, global and local indexes, batches with unprocessed-item handling, transactions with per-operation cancellation reasons, TTL, streams, backups and point-in-time recovery, PartiQL, table management.
  • Single-table design with key templates, derived index keys and mixed-entity collections.
  • Observable: structured events and logging, hooks, middleware, OpenTelemetry spans and metrics, per-request cost accounting (dynamoxy.collect()).
  • Testable: dynamoxy.testing.memory_client() is an in-memory DynamoDB with DynamoDB's semantics and fault injection; no Docker, no AWS account.
  • Fast and robust: a Rust core (AWS SDK for Rust, Tokio) handles transport, retries with backoff, timeouts and batching; wheels for Linux (x86_64, aarch64, glibc and musl), macOS and Windows, CPython 3.12+.

Install

uv add dynamoxy               # or: pip install dynamoxy
uv add 'dynamoxy[pydantic]'   # pydantic models
uv add 'dynamoxy[otel]'       # OpenTelemetry

Documentation

Getting started First model, connecting, first queries
Usage guide The compact reference (dynamoxy guide)
Guides Modeling, reading, writing, transactions, single-table design, testing, ...
Examples Runnable programs
Reference Configuration, errors, events
Architecture How it works, invariants, decisions
Changelog Release notes

AI agents: run dynamoxy guide (or read AGENT_GUIDE.md) before writing code with dynamoxy; application repositories can copy the skill in skills/dynamoxy. Agents changing dynamoxy itself start with AGENTS.md.

How it works

The Rust core (crates/dynamoxy-core) speaks DynamoDB through the AWS SDK for Rust, with its own retries, timeouts, batching, events and metrics, and contains a complete in-memory DynamoDB. A thin PyO3 binding exposes it to asyncio, and the Python package adds models, validation, repositories, transactions, constraints, hooks and OpenTelemetry.

Contributing

See CONTRIBUTING.md. The project is young (0.x): breaking changes are possible in minor versions and are called out in the changelog.

License

MIT

Metadata

Release files for dynamoxy 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dynamoxy 0.2.0
File Size Uploaded
dynamoxy-0.2.0.tar.gz 295.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for dynamoxy 0.2.0
File
dynamoxy-0.2.0-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details
dynamoxy-0.2.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
dynamoxy-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details
dynamoxy-0.2.0-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details
dynamoxy-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details
dynamoxy-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details
dynamoxy-0.2.0-cp312-abi3-macosx_11_0_x86_64.whl CPython 3.12 abi3 macOS 11.0+ x86-64 Details
dynamoxy-0.2.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details

Total release size: 51.6 MB

Release files / dynamoxy-0.2.0.tar.gz

Download URL dynamoxy-0.2.0.tar.gz
Size 295.6 kB
Tags Source
SHA-256 checksum
How to use checksums
88e2561b335683b1af12fec4cff8123db1028f80f3941c41fd4f91dd0e3483a4
BLAKE2b-256 checksum
How to use checksums
cace72a22e4d4d45f869cab4ad73388174ee54e09765bd0d4619d6225e0e6d71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-win_arm64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-win_arm64.whl
Size 6.4 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
7b26516592aed95fde6faf274c4a5b6cd86c6db17184051143a3aa98eb7081ba
BLAKE2b-256 checksum
How to use checksums
d419d85cb9f7ef1c93727746fd50a960b9bb6c371674471fbce074c200e9b923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-win_amd64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-win_amd64.whl
Size 6.7 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b26b10fc5a04ff40f2fc157f7869887c196eda466460461f9d4c7f98ad8aebb1
BLAKE2b-256 checksum
How to use checksums
c95362717515fd1f24b6c8762cefa375f07ec0b89a7a3d10bedc3dd0ff795b58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 6.6 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
aed3c8e41f0c1f236f5a40d27afaab28e2e003b1de30c766c1a8ce2f91438e37
BLAKE2b-256 checksum
How to use checksums
acd6e7c4df0cf651ea707f2662aec810d13584ef99f8b48e11c6fe28c13ddead
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 6.2 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
b7f16f012fd9629c9c981e48f984af421cedb5df15c235e6db9baaeb7dbcf737
BLAKE2b-256 checksum
How to use checksums
9b54276e704115fc17cf457b8a3ee89c111b8f599dc3cd9d8097ac3800093d8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.6 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
d77a50cb9e3e19e04c5a3a96e6c62e404d3886ca54fba1b325cde2fd28a4f951
BLAKE2b-256 checksum
How to use checksums
29fae8afbfe080c566b35bd374baef4bcbd0fe82cc12bb4f610f90ccbe63b3b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.2 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
f7028e97c3fa48cae643b95fdd4bdcd8ef3d1d4178a598cec925472752119223
BLAKE2b-256 checksum
How to use checksums
9f8e760e558e919b77639e1d91065c4d9a0d038c84b893109ce83cf56deb8777
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-macosx_11_0_x86_64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-macosx_11_0_x86_64.whl
Size 6.5 MB
Tags CPython 3.12 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
e6fde61388460ff15098cbebe04de421b021fb5b765e2d7353db3d8fa354e002
BLAKE2b-256 checksum
How to use checksums
2ce99924bca00afce3138fdca02e1a20da17a2b46be4f0570edd5e6963fa7210
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / dynamoxy-0.2.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL dynamoxy-0.2.0-cp312-abi3-macosx_11_0_arm64.whl
Size 6.0 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
88b0c220b12d8b8cbf13ae0ab55c07d5001d3ab9ca8409da35255a0d3d026792
BLAKE2b-256 checksum
How to use checksums
21350269d9520e6668488516f94cc333560ae8e2289dfd8d8043da40629a9636
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

9 release files

This release

0.2.0 This release

9 release files

0.1.0

9 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page