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)
)

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.1.tar.gz (101.2 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.1-cp311-abi3-manylinux_2_28_x86_64.whl (488.1 kB view details)

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

ferrum_orm-0.1.1-cp311-abi3-manylinux_2_28_aarch64.whl (478.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

ferrum_orm-0.1.1-cp311-abi3-macosx_11_0_arm64.whl (441.9 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

ferrum_orm-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl (452.8 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: ferrum_orm-0.1.1.tar.gz
  • Upload date:
  • Size: 101.2 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.1.tar.gz
Algorithm Hash digest
SHA256 57e38bc3d5618da035f29c9c283070fbf65b0b81325341b8970e67ddde5a2096
MD5 14a5973961019980234da4aa70aa288d
BLAKE2b-256 ff344e56d13d951da4eecb890cdd9b9d646b26a22075cd5b96136eaa5dce20e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.1.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.1-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.1-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4837ac4e0fa17853bd0947865c10a35c2f90cac0b85d0e4691c9c527ca01bd59
MD5 bb674d7a3745fb1e4683220ffa1aaec4
BLAKE2b-256 63cebccd1d8a90cca3212c79046dd2da314bfa43ae932b62cd78ba953f1d2e73

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.1-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.1-cp311-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.1-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4319819115ec960ea52b3a823fcf5529e0292b2187ebe9a9baba51e575bce28f
MD5 2dbcdd9d444976afe3f3b13a94688b16
BLAKE2b-256 256ad486567bb5f50f3b7bb3e080f44dd0e9ab3f82e46fa2628554f29685fa38

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.1-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.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f156f438ed984f129a87528a22f2e3479f79ff2ee2f57ba6e1afa47c42eaeba
MD5 7a522607023aeda4a7d19623649fa663
BLAKE2b-256 371a12ec6ad522dc4c5dac04ee74c330e40a613686471b5b8f87d4006782de28

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.1-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.1-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ferrum_orm-0.1.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ccc355076f2a5807d7504e7923e4fc9d275003f6e98c07a3ac5b9e59594de3ae
MD5 9cb9e8e89b3a400e883920e8a0b971e0
BLAKE2b-256 0b2581278e6675d374826aa415d83b793b2f8e919f8c1187a9d325e32d3a0ffe

See more details on using hashes here.

Provenance

The following attestation bundles were made for ferrum_orm-0.1.1-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