Skip to content

Split rust/gridr into a gridr-core (pure Rust) / gridr-py (PyO3) Cargo workspace #3

Description

@arnaudkelbert

Context

PR #2 exposes src/core as an rlib so it can be used from pure Rust (outside of Python), via crate-type = ["cdylib", "rlib"] plus an optional extension-module feature gating pyo3/numpy.

This works, but has two limitations:

  • core and pyapi still live in the same Cargo crate, with the API boundary maintained by convention (a feature flag) rather than by the package system itself.
  • Adding the rlib target triggers the crate's doctests, several of which don't actually compile (missing imports, malformed markdown fence, an ASCII diagram parsed as Rust code, two examples out of sync with their real signature) — previously hidden behind doctest = false.

Proposal

Split into a real two-member Cargo workspace:

  • gridr-core: the resampling/filtering engine, no pyo3/numpy dependency, default crate-type (rlib). This is the crate an external Rust project depends on directly.
  • gridr-py: the PyO3 binding layer, crate-type = ["cdylib"] only, depends on gridr-core as a path dependency. No more feature-gating needed since this crate now only serves the Python extension.

Benefits

  • API boundary enforced by the compiler, not by convention.
  • gridr-py never generates doctests again (cdylib-only): no risk of regressing on this again.
  • gridr-core becomes a real, documented, tested Rust-facing crate (real doctests, run in CI).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions