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

pip install ferrum-orm              # core ORM (asyncpg + pydantic); imported as `import ferrum`
pip install 'ferrum-orm[cli]'       # add Typer/Rich CLI tools
pip install 'ferrum-orm[cli,dotenv]'  # CLI + automatic .env loading

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.0.tar.gz (87.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.0-cp311-abi3-manylinux_2_28_x86_64.whl (467.9 kB view details)

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

ferrum_orm-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl (459.5 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ ARM64

ferrum_orm-0.1.0-cp311-abi3-macosx_11_0_arm64.whl (422.1 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

ferrum_orm-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl (433.1 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: ferrum_orm-0.1.0.tar.gz
  • Upload date:
  • Size: 87.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.0.tar.gz
Algorithm Hash digest
SHA256 8817c5ae2c3ba53b497a9f74cabae9895e32989be5eeb2682e205a8d04c3909d
MD5 786e70ee79ccd3b1b74d8b69fb9c1fd5
BLAKE2b-256 48c00992a791b24b813f02188e1556337735b8cb3a1026aec3df14c65a88678a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_orm-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 045592ca5dca3454a08ca5ccfb57d8bf0b93904db83a1d7fd5e0c8b752080909
MD5 036c01318ee6fabe108ed71f73667be3
BLAKE2b-256 5fa6d5d6b0f2908f92bc8e2566bb68822d3d476007b0834f52c9747fb4096d3e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_orm-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9a170b58fba8942c42f71f9bc94bb6e6e31a3cf95bfcbcb266ef2b91d2cd8ac1
MD5 e77dd7a42d0dbeb39de5dd66c627abdf
BLAKE2b-256 830b16a5d61b2397f50e760ce024f021e97ee2513c7b2e8a984cd0532a140226

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_orm-0.1.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ef4755bee6a61c487797db03cf9d2f1661bcdd0923c9cfdc7abfd3963d57fe6
MD5 20de8222d34e50afd00c334ba1d0b81f
BLAKE2b-256 828b7b856228ac0112d7285675138cadd0f55034163d280953ab5410560a7115

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ferrum_orm-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0c1cd6b0c0d2cbaab8d3a638eee233168fda33b40b85c9290aaff92dfc44b0dc
MD5 773568fc319ebdf8cfafb1b96796a9f9
BLAKE2b-256 be12b6c31119fa120ab1a676762490ce5c0ff612bd48dff5db1f3b508a781b54

See more details on using hashes here.

Provenance

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