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.8.0.tar.gz (256.5 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.8.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.8.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.8.0-cp314-cp314-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.8.0-cp314-cp314-macosx_10_12_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.8.0-cp313-cp313-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pydynox-0.8.0-cp312-cp312-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.8.0-cp311-cp311-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.8.0-cp311-cp311-macosx_10_12_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pydynox-0.8.0.tar.gz
Algorithm Hash digest
SHA256 ef2b512083da0f67d2edd469b3bb46e2a44fb6e3e8e2fab7ccdd0954b51b650e
MD5 e0c0705c7d53f382785063a9fc285878
BLAKE2b-256 1e09de720c55dcc6732c4a5af903f13083da19a90a1e101e586496df7b59ef98

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79f9f6e55ec0411e30550fa5c283f6ce4bbdebbc6c605810d094956ec9e666d0
MD5 e9e46c6a9c2b7fd29cc1a1573a19ccdd
BLAKE2b-256 d34aff8f444b6051ea5f6423e98efa862122d469eaa397f46ada394190e1d8a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1a27f1e386e826afe9deef92d6682aa2287a707b172aaeb03bee19925897d082
MD5 fc3ca9aaa8e91810f7cfab38a60bb88c
BLAKE2b-256 d08e5fb3006af40959d0d597735653fe85fdcef1286ff92c38737d650d065787

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e8e3b4a6e426e09d7f3091fcda6ba42b143777cb866d9bdb1e1b3991703dbbd
MD5 4aecfdf1386e449e467c5ce79bbceba3
BLAKE2b-256 98ee405f5bedcf7582275a4a279821406f7875fa875e323ddc18b0796ba174f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7aa11a93336c772c814a8eb5440ca45beb191583aa1cea43b655b5b30e638003
MD5 993f7c50493de6cc4a42e6a0076a6d0b
BLAKE2b-256 9d7b81cb1039579be064e4cce9e27fd7539d82c71debb154a2a38981e8c138bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2225618eee8b390ead73ae9925abe091c3b46861b565426ff87e7b609855fd71
MD5 213989872b417aa23562e179cb659813
BLAKE2b-256 a27cb4b6ae88948a5d05596e2ae6bee2a05d674c2a9464995a8a3ec8fe6d41fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b074635af7e58f2497a1c510fd3e775131647abf053426a4d804703337f51a14
MD5 4ad090df74fffa7ffb7e359cd9b84498
BLAKE2b-256 dbc87fea9feef1b42253a2a4bc991869756ef61a02af6ee89962fe28f8ccec87

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 280141d98c7f1acc5278bf8c6ed191f247c20b6713a3eca50f7507f0b621aaec
MD5 f4345364c5ff9e47fd9fad25c98af805
BLAKE2b-256 217b5336994bdf37b70ff01d5dd54646506c74175907761741fcea5571e12941

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8c394e81670a1c18097cd2c36c1f1a7389361ee66e5506fe8ad9412288acbe3f
MD5 e751b51c002be8c6d81e1c7bb8605170
BLAKE2b-256 97c1ff46655a019d213d4d4ef0c946b0ee981bf4152f2544a639064469a1703b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a86282792ed98c5f364ceace01d6cd94b66e5e51cdc6e35a03a6e7a34f93b9d2
MD5 7346c65d53ccdacb5b1e0a1219dc0328
BLAKE2b-256 f5ee4c2e8b5991b295691cd70753cf9150f4ff01e14053bf86c5df7bf428a443

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3af292a7f60983b6b6d31cbab473f77b7fc0e0c12d8533c1cf4db57ded01d5bc
MD5 67cfd930ddd2be80817ddb79dfb738c6
BLAKE2b-256 995e47061080b99ae338a261982fc5bbb6d488c41bdf5a812665f4a2f97a8b49

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c6b2c9dacc8c7daa8128c9c487be8f78973244cbca854c8634aabed11a83d982
MD5 afda7ae2c3b33fa9c0c245bd2d8a6992
BLAKE2b-256 994f84d7246d3daac062faa9cc76e49f203ab777bdfe31d93f0d33a45201ca5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3a4c6242629680b0a5f8533a9faf6d8a761a0f10257de3a097817427c51e8d4a
MD5 7d49b545a6044bf417f883a7b076baea
BLAKE2b-256 49bd5b4ca5118dd4bdca3012b7d8f95e14c0f201d7a4fda80a308cfa69590766

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e3ca9b488fdacbc9574debe83ce0237f27201b8e2b946b274adfb212eea6c20
MD5 f21cccc48abdd0a3d0d02341fba256f5
BLAKE2b-256 eaf61ffa2fde6e000791f56db5a3ed0e926b6285a25478470559ec68333146f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f24dd0d8ece3c4f099cf3edd031ac29cfba42caa908fb0f7ac18aa2bcbeb5e7d
MD5 83715bdf021606a22a68ef148b37ac47
BLAKE2b-256 67663e718f29054beef7dbe029a488f461522eef0f9f5bd6ba5a990c9dc79d1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b6b8b2cc8653a56b344ed6ca75b596b4700c128ac7422b90df903d98967dafc4
MD5 0091d7af01a615c271b9acf202215795
BLAKE2b-256 7c4fd2d72dd69b589bcb6f83a250dcbfe71565cd91269b95abd6954fb5e780b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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.8.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.8.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bd6adc34bd501c6ed439fd3fd9b12b0aa067522e02987069332fde852bbf2b13
MD5 9c587a65627486cd6a92176c9fcd7312
BLAKE2b-256 33a13928d70b319cbba0df21e5286b8e271db2a46992e34a0245280a627bbb82

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.8.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