Skip to main content

A fast DynamoDB ORM for Python with a Rust core

Project description

pydynox 🐍⚙️

CI PyPI version Python versions License Downloads

A fast DynamoDB ORM for Python with a Rust core.

⚠️ Early Development: This project is not ready for production yet. The API may change before v1.0.

We welcome feedback and contributions! Check the open issues to see what's planned or to share your ideas.

Why "pydynox"?

Py(thon) + Dyn(amoDB) + Ox(ide/Rust)

GenAI Contributions 🤖

This project welcomes GenAI-assisted contributions! Parts of the code and docstrings were written with AI help.

If you're using AI tools to contribute, check the .ai/ folder. It has all the guidelines:

  • .ai/README.md - Quick start for AI agents
  • .ai/project-context.md - What is pydynox, tech stack
  • .ai/coding-guidelines.md - Code style, Python vs Rust decisions
  • .ai/testing-guidelines.md - How to write tests
  • .ai/common-mistakes.md - Things that break the build

Rules for AI-assisted contributions:

  • Follow the project's coding style and patterns
  • Make sure the code makes sense and is tested
  • Don't submit random or low-quality generated code
  • Review and understand what the AI generated before submitting

Features

  • Simple class-based API like PynamoDB
  • Fast serialization with Rust
  • Batch operations with auto-splitting
  • Transactions
  • Global Secondary Indexes
  • Async support
  • Pydantic integration

Installation

pip install pydynox

For Pydantic support:

pip install pydynox[pydantic]

Quick Start

Define a Model

from pydynox import Model, ModelConfig, String, Number, Boolean, List

class User(Model):
    model_config = ModelConfig(table="users")
    
    pk = String(hash_key=True)
    sk = String(range_key=True)
    name = String()
    email = String()
    age = Number(default=0)
    active = Boolean(default=True)
    tags = List(String)

CRUD Operations

# Create
user = User(pk="USER#123", sk="PROFILE", name="John", email="john@test.com")
user.save()

# Read
user = User.get(pk="USER#123", sk="PROFILE")

# Update
user.name = "John Doe"
user.save()

# Delete
user.delete()

Query

from pydynox import Condition

# Simple query
users = User.query(pk="USER#123")

# With filters
users = User.query(pk="USER#123") \
    .where(Condition.begins_with("sk", "ORDER#")) \
    .where(Condition.gt("age", 18)) \
    .exec()

# Iterate (auto pagination)
for user in users:
    print(user.name)

Conditions

from pydynox import Condition

# Save with condition
user.save(condition=Condition.not_exists("pk"))

# Delete with condition
user.delete(condition=Condition.eq("version", 5))

# Combine conditions
user.save(
    condition=Condition.not_exists("pk") | Condition.eq("version", 1)
)

Available conditions:

  • Condition.eq(field, value) - equals
  • Condition.ne(field, value) - not equals
  • Condition.gt(field, value) - greater than
  • Condition.gte(field, value) - greater than or equal
  • Condition.lt(field, value) - less than
  • Condition.lte(field, value) - less than or equal
  • Condition.exists(field) - attribute exists
  • Condition.not_exists(field) - attribute does not exist
  • Condition.begins_with(field, prefix) - string starts with
  • Condition.contains(field, value) - string or list contains
  • Condition.between(field, low, high) - value in range

Atomic Updates

from pydynox import Action

# Simple set
user.update(name="New Name", email="new@test.com")

# Increment a number
user.update(Action.increment("age", 1))

# Append to list
user.update(Action.append("tags", ["verified"]))

# Remove field
user.update(Action.remove("temp_field"))

# Combine with condition
user.update(
    Action.increment("age", 1),
    condition=Condition.eq("status", "active")
)

Batch Operations

# Batch write
with User.batch_write() as batch:
    batch.save(user1)
    batch.save(user2)
    batch.delete(user3)

# Batch get
users = User.batch_get([
    ("USER#1", "PROFILE"),
    ("USER#2", "PROFILE"),
])

Global Secondary Index

from pydynox import GlobalIndex, ModelConfig

class User(Model):
    model_config = ModelConfig(table="users")
    
    pk = String(hash_key=True)
    sk = String(range_key=True)
    email = String()
    
    email_index = GlobalIndex(hash_key="email")

# Query on index
users = User.email_index.query(email="john@test.com")

Transactions

with User.transaction() as tx:
    tx.save(user1)
    tx.delete(user2)
    tx.update(user3, Action.increment("age", 1))

Async Support

# All methods work with await
user = await User.get(pk="USER#123", sk="PROFILE")
await user.save()

async for user in User.query(pk="USER#123"):
    print(user.name)

Pydantic Integration

from pydynox import dynamodb_model
from pydantic import BaseModel, EmailStr

@dynamodb_model(table="users", hash_key="pk", range_key="sk")
class User(BaseModel):
    pk: str
    sk: str
    name: str
    email: EmailStr
    age: int = 0

# All pydynox methods available
user = User(pk="USER#123", sk="PROFILE", name="John", email="john@test.com")
user.save()

Table Management

# Create table
User.create_table()

# Create with custom capacity
User.create_table(read_capacity=10, write_capacity=5)

# Create with on-demand billing
User.create_table(billing_mode="PAY_PER_REQUEST")

# Check if table exists
if not User.table_exists():
    User.create_table()

# Delete table
User.delete_table()

Documentation

Full documentation: https://leandrodamascena.github.io/pydynox

License

MIT License

Inspirations

This project was inspired by:

  • PynamoDB - The ORM-style API and model design
  • Pydantic - Data validation patterns and integration approach
  • dynarust - Rust DynamoDB client patterns
  • dyntastic - Pydantic + DynamoDB integration ideas

Building from Source

Requirements

  • Python 3.11+
  • Rust 1.70+
  • maturin

Setup

# Clone the repo
git clone https://github.com/leandrodamascena/pydynox.git
cd pydynox

# Install maturin
pip install maturin

# Build and install locally
maturin develop

# Or with uv
uv run maturin develop

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydynox-0.10.0.tar.gz (249.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydynox-0.10.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.10.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.10.0-cp314-cp314-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.10.0-cp314-cp314-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.10.0-cp313-cp313-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pydynox-0.10.0-cp312-cp312-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.10.0-cp311-cp311-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file pydynox-0.10.0.tar.gz.

File metadata

  • Download URL: pydynox-0.10.0.tar.gz
  • Upload date:
  • Size: 249.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pydynox-0.10.0.tar.gz
Algorithm Hash digest
SHA256 eccd2bfc83f1e7ae1371ee0982a04e9e7c1d6f376ecce9d314a42eca12f7ec25
MD5 e508c61432fbab2f47f50f68975425df
BLAKE2b-256 3319cd18968f653def1d571949764c775aeb84a3d00e9ca3a4d370b2b94490ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0.tar.gz:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c1c23f222319f6bb1329361207eaff8ef87c387f6ab6d8b4b548eec0ca948a1d
MD5 42594fbaa04976abe508d44430ba8280
BLAKE2b-256 f13ce02309f3a3247c57bd1c6de28725ae2cf104e91e05f35bcea29883c7de2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8350a83568258cb3f65dd336aa0d7a5a377c6ded8ca5eba267f62940c7303d59
MD5 0ab925cda5a29901e27da42de19177df
BLAKE2b-256 82ece218181d94cf4a987959b4e0625084fe31db7430248b059f5a59bdcfe9ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d3c78c89212cdd69e92071f56739e34a589b0f52695287313f1639a2455a77ed
MD5 510ca46143bdeb3a51ae5391a3f07c73
BLAKE2b-256 3c8be38a1e47877fbc0dc1996d0dd147fd726e48effe2a14eea26faab4fa50a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5f8c74808a5b0779dcbe4edad357b9501c1f5df818e14c76052ddc138b5eeeff
MD5 f79868f9e488b19816db39bc0970e759
BLAKE2b-256 c5c6614a6ddd0f8bc6e93f970097a7d16018f8f35ce201c2b12349c0dff451f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp314-cp314-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7633a690da23f1107d957fe4be9e31c4773088e4e82d6a1e209db11b5f764e3f
MD5 5c4092fc231ae7c1e5eeacb45b145fe0
BLAKE2b-256 55c94eac9647c2d98818204c3d4031670b3d60f262288add6b0923c13aff4045

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 630e78b8076c22d2798fc3f9321ee90506d3286d0080d4f8de6c8a0449c84863
MD5 8fb93c78962db879429a54b09d7f886e
BLAKE2b-256 a0f16bbb14dd1eb4a5ed205c23e9b617dd9950a913c51f32ad028ab7f7b60b45

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74491fc602cc28a822abb98a5357f11bcf5d9cd7351982c447173097092f3fdd
MD5 50d6dc3a4adff72f9a818291252a0e56
BLAKE2b-256 2d8c360be000c99c25ce67a6b3de4443c33e59447b00034a7e8ad7f459012da8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 65675aed10b96982fa4b49a6adfbef8a907ca21afb376e10bcb7345c84521f57
MD5 58438a4a0bd77c06338c18cf38733187
BLAKE2b-256 ecf3a3342d4eb27e7eeaebe345a89ad8cfe67038896fbe4596add40d3fcf4021

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2cd954bbd9db7076f6e4c23751925b10b20bc5a011253660dc25f69e051491d1
MD5 b03fd6f252bcc5b99dcb2f943cc0158a
BLAKE2b-256 f4da9bec2f77f56c8a3991c4ec98d878edf51ef80a4abca0d700895270649cb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5706caa9a3ba54fe3a92f660adebb105dd3a47740ddc184f4415c9dd7125de63
MD5 3aa2ac1decf5bdce07cf46a19965ed12
BLAKE2b-256 c1f9e41075755d8a0999bf7b467e89bf84685b95203d1ce761ddbb68eece3e3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b014dc2cddf2cfc552b9a216ec4b9c189c047b164636e32f2e495a547831236
MD5 e8c98b65fa0b589100585be38ea3f7c3
BLAKE2b-256 2748badc31e0d14395bbcc21de1b83a7cc91642e704e6f7f2071bae32aaa9d75

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a6eddb4cb7450eddc3381857375bcd8412920b637d94c7dd29a942f61082edd7
MD5 ed299d2c11a468cc2af45006d6acee4a
BLAKE2b-256 619fdd1e0b93be1a2a778efa04e33e67ca73bfbb0a30c6bca5abb73655fb5a09

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ad50035e1e5ac47b02ccee54db4aea0277e3efe09ffa229ac37b766eb8b47b0f
MD5 0d99d6f1a29843fac78b8f2e684de871
BLAKE2b-256 72e5d63e83c45473d286121851b4635e327a8d60f2227418ffc5cfe5bdb616dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a9d0b053753b78278b360c28307a89bec7b45da81f74b90308214f238bb8132
MD5 f036971f8e9c03b0690b763327ba11d2
BLAKE2b-256 19d8f1b74bc4f530b353f251267c98a6b0c4ac0784b5153ef4023996081b8590

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c6376821c98866e1976d10dadc59dee0b70e96afd51109d8922ef8c959f9392
MD5 df187d8a2b64784e7cc8aefefbe10d80
BLAKE2b-256 aef8deb6750e37b2ef30c5da2a3ea80eafe50688a7845446197be84071951dfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a28c649b4260314855f0246ae521adb5ac0ecdddfb95a06b793c25552e9035cf
MD5 e100e89f6eccea866a6a9292c3f90f01
BLAKE2b-256 c139d7eb48e8fc7fd36dc1cf0b351b895f555ac4df1a09144a967ef0bc3589fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page