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 users.update(ada, User.visits.add(1))  # atomic; `ada` is refreshed in place

        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.1.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.1.0
File Size Uploaded
dynamoxy-0.1.0.tar.gz 268.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for dynamoxy 0.1.0
File
dynamoxy-0.1.0-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details
dynamoxy-0.1.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
dynamoxy-0.1.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details
dynamoxy-0.1.0-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details
dynamoxy-0.1.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.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details
dynamoxy-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl CPython 3.12 abi3 macOS 11.0+ x86-64 Details
dynamoxy-0.1.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details

Total release size: 52.5 MB

Release files / dynamoxy-0.1.0.tar.gz

Download URL dynamoxy-0.1.0.tar.gz
Size 268.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4a2737b379e6adf005f6a328c34174340a71553aa903d39fdfce78cf0a6143ea
BLAKE2b-256 checksum
How to use checksums
d1e734e7dc164fa79226c9ec078a65a7f31fd6bf0cd107d24630f5068cac5944
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-win_arm64.whl
Size 6.6 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
44503ad02511ffe20a6382f3e45a570c69ded2c1b911e95d2be4396957cefa7e
BLAKE2b-256 checksum
How to use checksums
133d4a704c1c9832cdcd4dea67461ebea44706c5bb69cf2ce885c7f38a269da4
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-win_amd64.whl
Size 6.9 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
81df79e8cc6215e63979206118bad9c7ad46ed2a013bb4af2dad887a3b745f2f
BLAKE2b-256 checksum
How to use checksums
3c74ec632d2de6ee420e47f1f71b1cfe0659d82b18d05c6347de337d7e8a94fa
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 6.7 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
1459d4bb6fe23e5824368c67dadafac3a489937eca433cd156b4544a44888027
BLAKE2b-256 checksum
How to use checksums
73a78007c5cc61201dbdb21907e245ecc3349bc119772714f50b805c6befb072
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 6.3 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
cb9f47031c26c0cfc4c6e9294da4f888e4bbac2ea7648790e93a581898b33b4d
BLAKE2b-256 checksum
How to use checksums
08cdd5e5a5dda19f4fc5525b47c61fde4cdb794e1f56e96fca08d07e76a21e12
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
70f249e0ac2e2b6864143da6866cc99cd1be764794d55c6b361f870240190410
BLAKE2b-256 checksum
How to use checksums
a579734573516bbf90a2c6e465e1570f6605819e6eabbd55124cc6a83d898f7b
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 6.3 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
60ad0165c30d81310c103dba203e18d768ef517cea3a7bf70641d2f812347336
BLAKE2b-256 checksum
How to use checksums
ad8c9ec6a5bde425600cdcaf7a9e35bc10b42175f7bc9116b385d5ee88d2729c
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.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
e6de182833f962bc88b24c4ce1992be3ce04efe7162f5ed86b931603e4816032
BLAKE2b-256 checksum
How to use checksums
820b5125b23aac1a53250ad312fc5abf1de63f1e58d27a7377866919281fde2c
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 13, 2026.

Transparency log

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

Download URL dynamoxy-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Size 6.1 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3a3a3ac42c8e49ac565390fe410077cbdfba8b88f8675e716deba83bdf0c8006
BLAKE2b-256 checksum
How to use checksums
ec569531465858fb23a366cc474d4fce10cb159bd47df578ad532ac484a62aff
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 13, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

9 release files

0.2.0

9 release files

This release

0.1.0 This release

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