Skip to content

refactor: decouple core from PyO3, introduce ryx-rs native API, and expand type system#59

Merged
Einswilli merged 51 commits into
AllDotPy:masterfrom
Einswilli:new_design
Jun 2, 2026
Merged

refactor: decouple core from PyO3, introduce ryx-rs native API, and expand type system#59
Einswilli merged 51 commits into
AllDotPy:masterfrom
Einswilli:new_design

Conversation

@Einswilli

Copy link
Copy Markdown
Contributor

Here is a professional and structured Pull Request title and description in English, summarizing all the architectural ## Overview
This PR represents a major architectural milestone for Ryx. We have successfully decoupled the core ORM logic from the Python bindings (pyo3), paving the way for a fully native Rust ORM experience while preserving the performance and correctness of the Python API.

Additionally, we've introduced ryx-rs (the native Rust Django-style API) and ryx-macro for clean model declarations, expanded our SQL type-casting system, and updated our documentation to reflect these changes.


Key Changes

1. Architectural Decoupling & Modularization

  • Created ryx-common: Houses shared types like RyxError, PoolConfig, ModelMeta, and FieldMeta. This removes any direct dependencies on pyo3 or ryx-core from our fundamental layers.
  • Created ryx-rs: A pure, native Rust implementation of the Django-style ORM API.
  • Created ryx-macro: Contains macro definitions such as #[model] and #[relation] to dramatically simplify model declaration in Rust.
  • Refactored ryx-core: Stripped down to act purely as a PyO3 bridge between Rust and Python.
  • Python-Optional Backends: Modified ryx-backend to make ryx-core optional via a python feature flag, making the backend completely usable in pure Rust environments.

2. Expanded SQL Type System & Support

  • New SqlValue Variants: Expanded SqlValue to support specialized types: Date, DateTime, Time, Uuid, Decimal, and Json.
  • Database Casting: Updated Postgres, MySQL, and SQLite drivers to support proper binding, type casting, and heuristic decoding for these new variants.
  • Python Integration: Added custom error mapping (err_to_py / IntoPyResult) and sql_to_py conversions in ryx-python to properly handle these types across the PyO3 boundary.

3. Advanced Query Features in Rust (select_related)

  • Expanded the FromRow trait to support nested decoding via from_row_joined and from_row_prefixed.
  • Updated QueryNode and the SQL compiler to handle column-aliasing via extra_aliases.
  • Implemented select_related in ryx-rs's QuerySet, enabling single-query LEFT JOINs that automatically hydrate related nested structs.

4. Tests, Benchmarks, & CI

  • Added comprehensive relation tests in ryx-rs/tests/relation_test.rs.
  • Cleaned up database migration tests.
  • Added performance benchmarks in ryx-backend/benches/.
  • Corrected test paths in .github/workflows/ci.yml and updated the release workflow.

5. Documentation Overhaul

  • Landing Page: Streamlined and simplified the main README.md to highlight both Python and Rust quick-start examples, key features, and visual architecture.
  • Rust API Reference: Added complete Rust-centric documentation pages (docs/doc/rust/) detailing installation, CRUD, filtering, relationships, caching, and migrations.
  • Updated sidebars and existing Python guides to match the latest API changes.

How to Test

  1. Verify Python tests:
    uv run pytest ryx-python/tests/ -v
  2. Verify Rust tests:
    cargo test --workspace
  3. Run benchmarks:
    cargo bench -p ryx-backend

Einswilli added 30 commits May 10, 2026 11:36
…ormance optimizations

- Reflect the new Rust workspace (ryx-core, ryx-backend, ryx-query, ryx-python)
- Add 'Performance Philosophy' section describing Enum Dispatch and Zero-Allocation Rows
- Update CONTRIBUTING.md with new build process and coding conventions
- Create docs/doc/internals/performance.mdx for deep dive on optimizations
The test files have been relocated to the new workspace structure within the ryx-python crate (ryx-python/tests/).
- Refactor fields, models, queryset and migrations
- Update backend Rust code (MySQL/SQLite)
- Add benchmark for query compiler
- Fix compiler module declaration (compiler.rs -> compilr.rs)
@Einswilli Einswilli merged commit cfe9a80 into AllDotPy:master Jun 2, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant