-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCargo.toml
More file actions
91 lines (80 loc) · 5.36 KB
/
Cargo.toml
File metadata and controls
91 lines (80 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
[package]
name = "Ryx"
version = "0.1.2"
edition = "2024"
description = "Ryx ORM — a Django-style Python ORM powered by sqlx (Rust) via PyO3"
license = "MIT OR Apache-2.0"
authors = ["Wilfried GOEH", "AllDotPy", "Ryx Contributors"]
# ──────────────────────────────────────────────────────────────────────────────
# The crate is compiled as a C dynamic library so that Python can import it.
# "cdylib" → produces a .so / .pyd file that maturin renames to ryx_core.so
# We also keep "rlib" so that internal Rust tests (cargo test) can link against
# the library without needing a Python interpreter.
# ──────────────────────────────────────────────────────────────────────────────
[lib]
name = "ryx_core"
crate-type = ["cdylib", "rlib"]
# ──────────────────────────────────────────────────────────────────────────────
# Feature flags
#
# Each database backend is opt-in so users only compile what they need.
# Default: postgres only, which is the most common production choice.
#
# Usage in Cargo.toml:
# ryx = { version = "0.1", features = ["sqlite", "mysql"] }
# ──────────────────────────────────────────────────────────────────────────────
[features]
default = ["postgres", "mysql", "sqlite"] # enable all backends by default for dev convenience
postgres = ["sqlx/postgres"]
mysql = ["sqlx/mysql"]
sqlite = ["sqlx/sqlite"]
[dependencies]
ryx-query = { path = "./ryx-query" }
# ── PyO3 ──────────────────────────────────────────────────────────────────────
# "extension-module" is required when building a cdylib for Python import.
# Without it, PyO3 tries to link against libpython, which breaks on Linux/macOS
# when Python dynamically loads the extension.
pyo3 = { version = "0.28.3", features = ["extension-module"] }
# ── Async bridge ──────────────────────────────────────────────────────────────
# pyo3-async-runtimes is the maintained successor of the abandoned pyo3-asyncio.
# The "tokio-runtime" feature wires Rust Futures into Python's asyncio event
# loop via tokio — users simply `await` our ORM calls from Python.
pyo3-async-runtimes = { version = "0.28.0", features = ["attributes", "async-std-runtime", "tokio-runtime"] }
# ── sqlx ──────────────────────────────────────────────────────────────────────
# We use sqlx 0.8.x (stable). The "runtime-tokio" feature is mandatory since
# we drive everything through tokio. "macros" enables the query!/query_as!
# macros if needed later. "chrono" adds DateTime support.
sqlx = { version = "0.8.6", features = [
"runtime-tokio",
"macros",
"chrono",
"uuid",
"json",
"any"
], default-features = false }
# ── Tokio ─────────────────────────────────────────────────────────────────────
# Full tokio runtime. "full" is fine for a library crate — callers can restrict
# features if they need a lighter binary.
tokio = { version = "1.40", features = ["full"] }
smallvec = "1.13"
# ── Serialization ─────────────────────────────────────────────────────────────
# serde + serde_json: used to pass structured data between Rust and Python
# (row data, query parameters, etc.)
serde = { version = "1", features = ["derive"] }
serde_json = "1"
# ── Utilities ─────────────────────────────────────────────────────────────────
# thiserror: ergonomic error type derivation. We define a rich BityaError type
# that converts cleanly into Python exceptions via PyO3's IntoPy trait.
thiserror = "2"
# once_cell: used to store the global tokio Runtime and the connection pool
# as lazily-initialized singletons. Using std::sync::OnceLock would also work
# on Rust 1.70+, but once_cell has a slightly nicer API for our use case.
once_cell = "1"
# tracing: structured, async-aware logging. We instrument every SQL execution
# so users can enable RUST_LOG=ryx=debug for full query visibility.
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
[dev-dependencies]
# tokio test macro for async unit tests
tokio = { version = "1.40", features = ["full", "test-util"] }
criterion = { version = "0.5", features = ["async_tokio"] }