Skip to main content

Next-generation async ORM for Python with a Rust-powered core

Project description

Ferrum

A next-generation async ORM for Python. Rust-powered engine. Pydantic-native models. Django-inspired developer experience.

Ferrum is an async-first ORM designed for modern Python applications.

Built around a Rust-powered core and a Python-native API, Ferrum combines the ergonomics of Django's ORM, the type safety of Pydantic, and the performance of Rust.

Why Ferrum?

Existing Python ORMs often force developers to choose between:

  • Developer experience
  • Async support
  • Type safety
  • Performance

Ferrum aims to provide all four.

Goals

  • Native async from day one
  • Pydantic-first models
  • Django-inspired ORM experience
  • Rust-powered query engine
  • PostgreSQL-first architecture (MySQL and SQLite via optional extras)
  • Type-safe query construction
  • Automatic migrations
  • High-performance result hydration
  • Production-ready observability

Quick Example

from ferrum import Model


class User(Model):
    id: int
    email: str
    is_active: bool = True


user = await User.objects.create(
    conn,
    email="john@example.com",
)

users = await (
    User.objects
    .filter(is_active=True)
    .order_by("-id")
    .limit(10)
    .all(conn)
)

async with conn.transaction() as tx:
    user = await User.objects.create(tx, email="jane@example.com")
    await AuditLog.objects.create(tx, user_id=user.id, action="signup")

Features

Async First

No synchronous compatibility layer.

Ferrum is designed around modern async Python applications.

users = await User.objects.all(conn)

Pydantic Native

Models are built directly on top of Pydantic.

class User(Model):
    id: int
    email: str

No duplicate schema definitions.

Django-Inspired API

Familiar query interface.

users = await (
    User.objects
    .filter(email__contains="@gmail.com")
    .order_by("-created_at")
    .all(conn)
)

Rust-Powered Core

Performance-critical components are implemented in Rust:

  • Query compilation
  • SQL generation
  • Result decoding
  • Schema analysis
  • Migration planning

This allows Ferrum to maintain a Pythonic API without sacrificing performance.

Architecture

┌──────────────────────────┐
│      Python API          │
│  Models / QuerySets      │
└────────────┬─────────────┘
             │
             ▼
┌──────────────────────────┐
│      Ferrum Core         │
│      (Rust Engine)       │
├──────────────────────────┤
│ Query Compiler           │
│ SQL AST                  │
│ Result Decoder           │
│ Migration Planner        │
└────────────┬─────────────┘
             │
             ▼
┌──────────────────────────┐
│       PostgreSQL         │
└──────────────────────────┘

Roadmap

v0.1

  • PostgreSQL support
  • Basic CRUD operations
  • Async query execution
  • Pydantic models
  • Query builder
  • Type-safe filters

v0.2

  • Relationships
  • Transactions
  • Query optimization
  • Bulk operations

v0.3

  • Migrations
  • Schema diff engine
  • CLI tools

v1.0

  • Production-ready stability
  • Advanced relationships
  • Performance benchmarking
  • Full documentation

Project Status

Ferrum is currently in active development.

The API is not yet stable and breaking changes should be expected until the first public release.

Installation

# PostgreSQL (most common)
pip install 'ferrum-orm[pg]'

# PostgreSQL + migrations CLI
pip install 'ferrum-orm[pg,cli]'

# MySQL
pip install 'ferrum-orm[mysql]'

# SQLite + migrations CLI (testing / local dev)
pip install 'ferrum-orm[sqlite,cli]'

# Everything (all drivers + CLI + dotenv)
pip install 'ferrum-orm[all]'

# Core ORM only (no database driver — install a driver extra before connecting)
pip install ferrum-orm

Bare ferrum-orm installs Pydantic and the Rust core only. Choose a driver extra (pg, mysql, or sqlite) before calling ferrum.connect().

From source, build the native extension with maturin develop (or mise run dev).

Examples

Runnable samples live under examples/:

Contributing

Contributions are welcome.

License

Apache License 2.0

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

ferrum_orm-0.1.2.tar.gz (105.0 kB view details)

Uploaded Source

Built Distributions

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

ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_x86_64.whl (501.0 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl (490.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

ferrum_orm-0.1.2-cp311-abi3-macosx_11_0_arm64.whl (455.3 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

ferrum_orm-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl (466.9 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file ferrum_orm-0.1.2.tar.gz.

File metadata

  • Download URL: ferrum_orm-0.1.2.tar.gz
  • Upload date:
  • Size: 105.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ferrum_orm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 cca53472f304dda0a0d635d71d7661fbbd15f94f3a42401efb0d26aeec4d48b7
MD5 f304c5e43f469bde64bb8a1688dd02fb
BLAKE2b-256 07726fb0ae64659bbb1060041d17af18e1cf5064340bcd7ed8d9917f8635375b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.2.tar.gz:

Publisher: release.yml on ferrum-orm/ferrum

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

File details

Details for the file ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 28d9efedd24e26d23dc3fa261af53ad3093317a4e33dcfa67550ae4cd61f3db5
MD5 e604e8b67c260952caacd1f846f40fcc
BLAKE2b-256 2e76cbe141e06086f65844ad8aea8c723c49c9a9fee67f9962bf1364652007ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on ferrum-orm/ferrum

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

File details

Details for the file ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2ab391a40bf7b32e4a8135af6006c3652226885a9fab1d27a9d9d5875cc21f85
MD5 54ebbeb06ed82a3fd62a92b6632d0fdd
BLAKE2b-256 52d42583baecb36bc7c9f232aff8fca93095e5d43d181efa9d5c09f76418d839

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.2-cp311-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on ferrum-orm/ferrum

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

File details

Details for the file ferrum_orm-0.1.2-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.2-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b76d6c43817cbed02fb75bb5ac2d823c6941c25baa86a7bf72874f9fd2ad8b19
MD5 e7216f67b5afba30f76d5b64edf498d4
BLAKE2b-256 7edb7b1d1fbb4c74037c2883874a6b8fd9f668cdd9d1abca4305f951cb188bd2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.2-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on ferrum-orm/ferrum

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

File details

Details for the file ferrum_orm-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 87ddb8048aeebc24fa9e867f2035e6f86ebb68651545266cda6f0daca5be9c01
MD5 3282570a7ff582d91a275baa93d081b3
BLAKE2b-256 cf024e1df81abcf1e1764869925cee86c405354b98b9fdf16947f51adac07657

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.2-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on ferrum-orm/ferrum

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