diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 641396f..c33da4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,131 +2,81 @@ name: CI on: push: - branches: [main, master, develop, "feat/*"] + branches: [main, master, "feat/*"] pull_request: - branches: [main, master, develop] + branches: [main, master] -env: - CARGO_TERM_COLOR: always - RUST_BACKTRACE: 1 +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - fmt: - name: Format Check + # 1. Separate linting to fail fast + static-analysis: + name: Lint & Format runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - components: rustfmt - - - name: Install protobuf compiler - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler + - name: Install Protoc + uses: arduino/setup-protoc@v3 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' + cache: 'pip' - - name: Install Python dependencies - run: pip install -e .[dev] + - uses: dtolnay/rust-toolchain@stable + + - name: Install Linting Tools + run: | + pip install black ruff mypy - - name: Check formatting + - name: Rust Fmt run: make fmt-check - lint: - name: Clippy Lint + - name: Rust Clippy + run: make lint + + build-and-test: + name: Build & Test runs-on: ubuntu-latest + needs: static-analysis steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - components: clippy + - uses: actions/checkout@v4 - - name: Install protobuf compiler - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler + - name: Install Protoc + uses: arduino/setup-protoc@v3 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.10' + cache: 'pip' - - name: Install Python dependencies - run: pip install -e .[dev] - - - name: Cache dependencies - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "v0-rust" - shared-key: "stable" - - - name: Run clippy - run: make lint - - test: - name: Rust Tests - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install protobuf compiler - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - - name: Install Rust toolchain + - name: Install Rust uses: dtolnay/rust-toolchain@stable - - name: Cache dependencies + # The heavy lifter: caches target/ and cargo registry + - name: Cache Rust uses: Swatinem/rust-cache@v2 - with: - prefix-key: "v0-rust" - shared-key: "stable" - - - name: Run tests - run: make test - - build: - name: Build Check - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install protobuf compiler - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + - name: Install Build & Test Dependencies + run: | + python -m pip install --upgrade pip + # patchelf is required for maturin to repair manylinux wheels + pip install maturin patchelf - - name: Cache dependencies - uses: Swatinem/rust-cache@v2 - with: - prefix-key: "v0-rust" - shared-key: "stable" + - name: Install Project (Editable) + # --no-build-isolation is the key to speed: it uses the cached + # Rust toolchain and dependencies instead of creating a fresh env. + run: pip install -e .[dev] --no-build-isolation - - name: Build project - run: make build + - name: Run Tests + # Ensure 'make test' points to your pytest / python test suite + run: make test - # Summary job that depends on all checks - ci-success: - name: CI Success - runs-on: ubuntu-latest - needs: [fmt, lint, test, build] - if: always() - steps: - - name: Check all jobs passed - run: | - if [[ "${{ needs.fmt.result }}" != "success" ]] || \ - [[ "${{ needs.lint.result }}" != "success" ]] || \ - [[ "${{ needs.test.result }}" != "success" ]] || \ - [[ "${{ needs.build.result }}" != "success" ]]; then - echo "One or more jobs failed" - exit 1 - fi - echo "All CI checks passed!" + - name: Build Wheel (Optional check) + # This confirms the project can package correctly for distribution + run: maturin build --out dist \ No newline at end of file diff --git a/README.md b/README.md index ff124bf..40ee841 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Grism +[![CI](https://github.com/mirasoth/Grism/actions/workflows/ci.yml/badge.svg)](https://github.com/mirasoth/Grism/actions/workflows/ci.yml) + **AI-native, neurosymbolic hypergraph database** Grism is a hypergraph-first database designed for knowledge representation, semantic reasoning, and multi-modal data processing. It combines the expressiveness of n-ary relations with low-latency graph traversal and scalable computation. @@ -54,5 +56,4 @@ cargo test ## License -See [LICENSE](LICENSE) for details. - +See [LICENSE](LICENSE) for details. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 89729c1..ad2f4e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ Issues = "https://github.com/mirasoth/Grism/issues" [tool.maturin] # Build with Python feature enabled -features = ["python"] +features = ["python","pyo3/extension-module"] # Python source directory (root contains the grism/ package) python-source = "." # Module name - the native extension lives at grism._grism diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 7063c8d..780aa01 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.92.0" # Pin to specific version - update periodically +channel = "stable" components = ["rustfmt", "clippy"] profile = "minimal" \ No newline at end of file diff --git a/specs/rfc-0012.md b/specs/rfc-0012.md index 700b742..1faa001 100644 --- a/specs/rfc-0012.md +++ b/specs/rfc-0012.md @@ -241,7 +241,7 @@ For the local execution engine, the following backends are supported: | Backend | Persistence | Description | | ----------------- | ----------- | ---------------------------------- | -| `InMemoryStorage` | None | Ephemeral, testing and prototyping | +| `MemoryStorage` | None | Ephemeral, testing and prototyping | | `LanceStorage` | Local FS | Persistent, Lance-based datasets | Both conform strictly to the `Storage` trait. @@ -255,7 +255,7 @@ For Ray-based distributed execution, storage is backed by cloud object stores: * S3 * GCS * Azure Blob -* Other Daft-supported backends +* Other cloud object stores Key requirements: diff --git a/specs/rfc-0102.md b/specs/rfc-0102.md index 3222219..4b914e4 100644 --- a/specs/rfc-0102.md +++ b/specs/rfc-0102.md @@ -371,7 +371,7 @@ The local runtime supports multiple storage backends: | Backend | Description | Use Case | |---------|-------------|----------| -| `InMemoryStorage` | Hash-map based storage | Testing, small datasets | +| `MemoryStorage` | Hash-map based storage | Testing, small datasets | | `LanceStorage` | Lance format file storage | Production, large datasets | Storage is accessed through the `Storage` trait defined in `grism-storage`. diff --git a/src/common/error/src/error.rs b/src/common/error/src/error.rs index 353ca9a..28ef207 100644 --- a/src/common/error/src/error.rs +++ b/src/common/error/src/error.rs @@ -117,7 +117,7 @@ impl GrismError { Self::InternalError(msg.into()) } - /// Create an out-of-spec error (following Daft's parquet2 pattern). + /// Create an out-of-spec error. #[must_use] pub fn oos>(msg: S) -> Self { Self::OutOfSpec(msg.into()) diff --git a/src/common/error/src/lib.rs b/src/common/error/src/lib.rs index c6da7ec..e8610a6 100644 --- a/src/common/error/src/lib.rs +++ b/src/common/error/src/lib.rs @@ -1,7 +1,6 @@ //! Error types and result aliases for Grism. //! -//! This module provides the core error handling infrastructure following -//! the pattern from Daft's error module. +//! This module provides the core error handling infrastructure mod error; #[cfg(feature = "python")] diff --git a/src/grism-core/src/types/mod.rs b/src/grism-core/src/types/mod.rs index 1ed6f09..af6a494 100644 --- a/src/grism-core/src/types/mod.rs +++ b/src/grism-core/src/types/mod.rs @@ -1,9 +1,7 @@ //! Type system for Grism values. //! //! This module defines the `Value` enum for runtime values and -//! `DataType` for type information, following the pattern from -//! Daft's parquet2 spec.rs for invariant checking. - +//! `DataType` for type information. mod data_type; mod spec; mod value; diff --git a/src/grism-core/src/types/spec.rs b/src/grism-core/src/types/spec.rs index 526035c..30f6cdb 100644 --- a/src/grism-core/src/types/spec.rs +++ b/src/grism-core/src/types/spec.rs @@ -1,4 +1,4 @@ -//! Type invariant checking (following Daft's parquet2/spec.rs pattern). +//! Type invariant checking. use common_error::{GrismError, GrismResult}; diff --git a/src/grism-engine/src/python/mod.rs b/src/grism-engine/src/python/mod.rs index 5377b0e..d5ec187 100644 --- a/src/grism-engine/src/python/mod.rs +++ b/src/grism-engine/src/python/mod.rs @@ -1,7 +1,6 @@ //! Python bindings for executors. //! -//! This module provides `PyO3` bindings for the Grism execution engine, -//! following the Daft pattern of individual python modules per crate. +//! This module provides `PyO3` bindings for the Grism execution engine. #![allow(unsafe_op_in_unsafe_fn)] @@ -88,14 +87,13 @@ impl PyRayExecutor { } } -// ========== Module Registration (Daft Pattern) ========== +// ========== Module Registration ========== /// Register all Python bindings from this crate with the parent module. /// -/// Following the Daft pattern, each crate exports a `register_modules` function -/// that registers its Python classes and functions with the parent module. +/// Each crate exports a `register_modules` function that registers its Python +/// classes and functions with the parent module. pub fn register_modules(parent: &Bound<'_, PyModule>) -> PyResult<()> { - // ========== Executor Classes ========== parent.add_class::()?; parent.add_class::()?; parent.add_class::()?; diff --git a/src/grism-logical/src/python/mod.rs b/src/grism-logical/src/python/mod.rs index 3696203..cef1567 100644 --- a/src/grism-logical/src/python/mod.rs +++ b/src/grism-logical/src/python/mod.rs @@ -1,8 +1,7 @@ //! Python bindings for the Grism expression system. //! -//! This module provides `PyO3` bindings for expressions, following the Daft pattern -//! of individual python modules per crate. Implements expression lowering to Rust -//! `LogicalExpr` per RFC-0003. +//! This module provides `PyO3` bindings for expressions. Implements expression +//! lowering to Rust `LogicalExpr` per RFC-0003. #![allow(unused_unsafe)] #![allow(unsafe_op_in_unsafe_fn)] @@ -1278,11 +1277,11 @@ impl PyPattern { } } -// ========== Module Registration (Daft Pattern) ========== +// ========== Module Registration ========== /// Register all Python bindings from this crate with the parent module. /// -/// Following the Daft pattern, each crate exports a `register_modules` function +/// Each crate exports a `register_modules` function /// that registers its Python classes and functions with the parent module. pub fn register_modules(parent: &Bound<'_, PyModule>) -> PyResult<()> { // ========== Expression Classes ========== diff --git a/src/python/mod.rs b/src/python/mod.rs index c8141da..f13dfde 100644 --- a/src/python/mod.rs +++ b/src/python/mod.rs @@ -1,7 +1,6 @@ //! Python bindings for Grism. //! -//! This module provides PyO3 bindings for the Grism Python API, -//! following the Daft pattern of individual python modules per crate. +//! This module provides PyO3 bindings for the Grism Python API. //! //! The Python API implements the specification in RFC-0101 (Python API Contract), //! with expression lowering to Rust LogicalPlan per RFC-0002, RFC-0003, and RFC-0006. @@ -22,11 +21,11 @@ pub use hypergraph::{ /// Register all Python bindings with the module. /// -/// Following the Daft pattern, this function orchestrates registration +/// This function orchestrates registration /// by calling each sub-crate's `register_modules` function and then /// registering types specific to the main crate. pub fn register_module(m: &Bound<'_, PyModule>) -> PyResult<()> { - // ========== Register Sub-crate Modules (Daft Pattern) ========== + // ========== Register Sub-crate Modules ========== // Each crate manages its own Python bindings grism_logical::python::register_modules(m)?; grism_engine::python::register_modules(m)?;