|
1 | 1 | # type-bridge-core |
2 | 2 |
|
3 | | -Rust core for the `type-bridge` TypeDB ORM. |
| 3 | +Rust core for the **type-bridge** TypeDB ORM — high-performance AST, schema parser, query compiler, validation engine, and value coercer. |
4 | 4 |
|
5 | | -## Overview |
| 5 | +## Workspace structure |
6 | 6 |
|
7 | | -This crate provides a high-performance, shared type system and query engine for `type-bridge`. It enables: |
8 | | - |
9 | | -- **Bidirectional Validation**: Define validation rules once in Rust and enforce them on both client (Python) and server (Rust/WASM). |
10 | | -- **Query Object Portability**: First-class AST objects that can be serialized and moved between runtimes. |
11 | | -- **Performance**: High-speed query compilation and schema parsing. |
| 7 | +``` |
| 8 | +type-bridge-core/ |
| 9 | +├── Cargo.toml # Workspace root |
| 10 | +└── crates/ |
| 11 | + ├── core/ # type-bridge-core-lib (pure Rust, no runtime deps) |
| 12 | + ├── python/ # type-bridge-core (PyO3 bindings → Python) |
| 13 | + └── server/ # type-bridge-server (query pipeline + HTTP API) |
| 14 | +``` |
12 | 15 |
|
13 | | -## Structure |
| 16 | +## Crates |
14 | 17 |
|
15 | | -- `src/core`: Pure Rust implementation of the AST, schema, and validation engine. This is runtime-agnostic. |
16 | | -- `src/ast`: PyO3 wrappers for the core AST nodes, providing an idiomatic Python API. |
17 | | -- `src/lib.rs`: PyO3 module definition. |
| 18 | +| Crate | Description | |
| 19 | +|-------|-------------| |
| 20 | +| [`type-bridge-core-lib`](crates/core/) | Pure-Rust TypeQL AST, schema parser, query compiler, validation engine, and value coercer | |
| 21 | +| [`type-bridge-core`](crates/python/) | PyO3 bindings exposing the Rust core to Python via serde-tagged-enum dicts | |
| 22 | +| [`type-bridge-server`](crates/server/) | Transport-agnostic query pipeline with validation, interceptors, and HTTP API | |
18 | 23 |
|
19 | 24 | ## Building |
20 | 25 |
|
21 | | -To build the Python extension: |
22 | | - |
23 | 26 | ```bash |
| 27 | +# Check all crates (requires PYO3 compat flag on Python ≥ 3.14) |
| 28 | +PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 cargo check --all-targets |
| 29 | + |
| 30 | +# Build the Python extension |
24 | 31 | cd type-bridge-core |
25 | | -maturin develop |
| 32 | +PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 maturin develop |
| 33 | + |
| 34 | +# Run tests |
| 35 | +cargo test -p type-bridge-core-lib -p type-bridge-server |
| 36 | + |
| 37 | +# Generate docs |
| 38 | +PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 cargo doc --no-deps --open |
| 39 | +``` |
| 40 | + |
| 41 | +## Local CI mirror |
| 42 | + |
| 43 | +Use the project-level check script to mirror CI locally: |
| 44 | + |
| 45 | +```bash |
| 46 | +./scripts/check.sh rust # Rust checks only |
| 47 | +./scripts/check.sh python # Python checks only |
| 48 | +./scripts/check.sh # Both |
26 | 49 | ``` |
27 | 50 |
|
28 | | -## Status |
| 51 | +## License |
29 | 52 |
|
30 | | -This is an initial implementation following the RFC in issue #95. Key structures are in place, with logic being ported from Python. |
| 53 | +MIT |
0 commit comments