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.7.0.tar.gz (242.8 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.7.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.7.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.7.0-cp314-cp314-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.7.0-cp314-cp314-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.7.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.7.0-cp313-cp313-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pydynox-0.7.0-cp312-cp312-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.7.0-cp311-cp311-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pydynox-0.7.0.tar.gz
Algorithm Hash digest
SHA256 141970ec6d9de91b4044e709afee642223e66402d1173fc9aa0aa56b7613dfe9
MD5 5a00f0137ced42be47edcbbf5659126d
BLAKE2b-256 d7d559e64db48592523138f0e989dee6733a82d1e548858ed2c83e5f25b1bac7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e69eecc56a64762e9ec71db5d267b78d680e886a674b3b815b17d1c5ca529e63
MD5 7cf2d815878fa9f8a8d6b58eb264ac45
BLAKE2b-256 1cccece78bf2cfb1966e3ddb3e072c70c79527bd06ba20eb78e4643db926b443

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b5c0b2ddad743514357a8eb3567c1c301fd8a834c7248c006abf71f323c6e7dc
MD5 456c7c6672c356118dbaa97a93770c71
BLAKE2b-256 6eb38aeed523604216a9748f3785ef2bd8f07037512f5d78ebd55cd1e284ec76

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de922ef287842a9eb3af7586686147465c9975c179f5f7a55ab7bc59a9dd4e7b
MD5 2d375834ac4f3c036a835ac8f5d9ca76
BLAKE2b-256 639d77c0ce1e8667cac25f0b88ab00103fe98a8139dd206b22232c794302a386

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c6ff67be07bcadafaf5a4a8e663b4a2f9e807db4c5d55d2f74762b7c9e0da78c
MD5 24e6421bb3e718f1ea68f4a50ffbd302
BLAKE2b-256 eee4b617b193a886176078b54f363ab8a64a78059a80790633479b9a74b77884

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7081339d2f7810a45de91c7478f7f9710e14d8bf67501d4a292efe841fefd3b5
MD5 c779476d119a454400d58cbaa3e66b62
BLAKE2b-256 b2e48dc4fd165fc51615951a8092ddd7a816a8c889259aac3c57abcd9def6a49

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb5dea400c7377779782cf69836d4568dd04807d5f0c3c92d67862045360c9f2
MD5 7e56111a96f9f288df5ce2308a9361c6
BLAKE2b-256 077e840e97d2c8b0b63b9a6de6020372936757c4cfec2b0d098439eccd319df3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 661812f268d198f5eb194b9b0440bba54f059e5351d2a2388264a851d4943ef9
MD5 49990b75000e68be78f83215703521e7
BLAKE2b-256 de4be6f2ae35e01f4883e71d2c4a061cf9857cee0bb9e0e6c558b92efe0164b6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f3daf44002375f4c8e532623509cb004db01302d6be3efab57431523900c0d12
MD5 530668f49232ac09b0ba755605cf8cfe
BLAKE2b-256 54d9df48404f979bf909940f582589dfa48b83137d6d491ba6990cfe5883524c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3db800aad15cfe03c87ce71a3d98c94926f94dec85842885906089600561643b
MD5 56f2d4afac28f7075740ca4dec29204e
BLAKE2b-256 9bb9c8516bfe4c9d4889d4f2f793ba8e83bd55dc9a1a82a147683d3f3b6ae905

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6d605054cea15a2632d83b3a0a5e0714c24b901019ced4b708468a9e1bdf0a40
MD5 713d4b537445001b12b8642d38df52a7
BLAKE2b-256 db20822639644da2b3b0866961753ab09a9b977d00b1c6794cc9a49451cf9f72

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 565813755916eadc5e86833b396c944e77c2c93174a02568c8042426d79ad309
MD5 b3ff9d1cc25641c529cfbef56a6262aa
BLAKE2b-256 f3445af1228cb200f8b152bc6a29d46378c26ae6325a8ab5e59a5815573546ec

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a433944bb6869d936728cd8c7a7d46723bcc477b9899d7138561f6c0b5446b9e
MD5 47021364c7903f140cb5034f84fb7334
BLAKE2b-256 650fe2d85d88215b0536af2ae8e900247d0e62668de6779386d1bbac70802fef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26ad4ebc7e50b3865e480b57ab55dc32ff2ec4ff981a554a14326348dc8e4d0d
MD5 d0a2005e2d947c8b1e676046517d70d5
BLAKE2b-256 c4b6270a8a273208f9f99ca4b21ee96cab68a8208336dcd21de3c89ee740f6c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db863196695df13dca06b46d65e2df1ec367cbc5386c63823386144c83a658d7
MD5 c9248bc2a8310372a40ae622121a56ea
BLAKE2b-256 acd47a44b542eb71eb0613dfdb4d3bd3cd8711a4f67d9301c4245903f8aaab8d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7e5dc8adf4f924746f9b720047278cc75918a4ba4a21300eac57de64baf63a0
MD5 6c3952cef76ab92870fd253f9d7edd05
BLAKE2b-256 986c97197ab7bc65de2bc9dc1d1fbef5a9d3c5b733c9659cb589165a2868f31d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 48ba87243a135d77e691fb35d3d8c1de04b96ef2813fe7fbb1d977c6154f2c3a
MD5 66f20d7428835e3b913a3ab8d991ba68
BLAKE2b-256 6766b3c84b451b5dba924e8ccd314611e779beb9dba1ac20b820776c9d4dcc84

See more details on using hashes here.

Provenance

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