Skip to content

refactor: standardize 5-slot layout, modularize ncl_curly/, and add PEP 562 lazy imports + zero-tax native fast paths - #2

Merged
QianyeSu merged 1 commit into
mainfrom
refactor/standard-layout-and-zero-tax-py
Dec 1, 2026
Merged

QianyeSu merged 1 commit into
mainfrom
refactor/standard-layout-and-zero-tax-py

Conversation

@QianyeSu

Copy link
Copy Markdown
Member

Summary

Standardize skyborn-plot into the Gold-Standard Template #2 layout (5-slot layout, modular ncl_curly/ Rust submodule directory, _plot_rs.pyi type stub + py.typed, PEP 562 lazy __init__.py, and zero-tax positional Rust fast paths in _core/native.py) with zero behavioral or numerical change.

Key Changes

  • Archive Standardization: git mv c_ref legacy; updated all c_ref references in legacy/README.md, pyproject.toml (exclude = ["legacy/**", "tools/**", "benchmarks/**", "rust/target/**", "target/**", "assets/**"]), and .github/workflows/ci.yml (paths-ignore).
  • Modular rust/skybornplot-core/src/ncl_curly/ (7 submodules, 3,034 lines total, preserving skybornplot_core::ncl_curly::* 1:1):
    • mod.rs (133 lines), grid.rs (631 lines), trace.rs (929 lines), thinning.rs (282 lines), stipple.rs (192 lines), arrows.rs (208 lines), tests.rs (659 lines).
  • PEP 562 Lazy src/skybornplot/__init__.py: preserves __version__, exact __all__, skyborn.plot re-export compatibility, _SkybornPlotModule.__setattr__ guard so import skybornplot.scatter does not shadow skybornplot.scatter, and leaves 'matplotlib' not in sys.modules on bare import skybornplot.
  • Typing Support: added src/skybornplot/_plot_rs.pyi (covering all 18 PyO3 functions across nclcurly, contour_arrows, and contour) and src/skybornplot/py.typed.
  • Zero-Tax Native Fast Paths (src/skybornplot/_core/native.py): added _as_f64 / _as_intp helpers and positional-argument fast paths when native_fn is _rs_*, skipping redundant post-call np.asarray and ~np.isfinite rescans while keeping exact mock/fallback paths intact.

Verification & Neon QA Acceptance (#240)

  • cargo test --release --workspace --exclude skybornplot-py: 26 / 26 passed.
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --exclude skybornplot-py --no-deps: 0 warnings.
  • pytest (RAM-disk wheel stage): 448 passed, 1 skipped (including tests/test_rust_parity.py: 12 / 12 against live v0.1.0 C oracle).
  • Cross-repo Skyborn/tests/test_plot_*.py: 407 passed, 1 skipped; skyborn.plot 11/11 alias verified.
  • Performance (hyperfine / E2E benchmarks):
    • Cold import skybornplot: 85.9x faster (1.323 s -> 0.015 s), 8.8x less RAM (165.0 MiB -> 18.7 MiB).
    • curly_vector E2E (73x144, 20 figs): 1.89x faster (52.91 ms/fig -> 28.05 ms/fig).
    • scatter cells E2E (73x144, 20 figs): 1.76x faster (41.48 ms/fig -> 23.56 ms/fig).

…EP 562 lazy imports + zero-tax native fast paths
@QianyeSu
QianyeSu merged commit 5e4fb75 into main Dec 1, 2026
10 checks passed
@QianyeSu
QianyeSu deleted the refactor/standard-layout-and-zero-tax-py branch December 1, 2026 03:41
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