Skip to content

refactor: inline dlpack-sys into dlpack-rs (single publishable crate, 0.3.3) - #8

Merged
edgarriba merged 3 commits into
mainfrom
inline/dlpack-sys
Jul 6, 2026
Merged

edgarriba merged 3 commits into
mainfrom
inline/dlpack-sys

Conversation

@edgarriba

Copy link
Copy Markdown
Member

Supersedes #7. No sys crate to publish — fold dlpack-sys into dlpack-rs as a private sys module.

Why: publishing dlpack-rs to crates.io needs its dlpack-sys path dep to be a published versioned crate, but the dlpack-sys name is squatted. DLPack is header-only (structs/consts + fn-pointer types, zero native linkage), so the sys split buys nothing — inline it and dlpack-rs (which we own on crates.io) publishes as one self-contained crate.

  • src/sys.rs: include!("bindings.rs") + ABI test; src/ffi.rs re-exports crate::sys::*
  • build.rs + vendor/ + bindings.rs at crate root; bindgen stays an opt-in feature (default uses committed bindings, no libclang)
  • [lib] doctest = false; delete dlpack-sys/; bump 0.3.2 → 0.3.3; no public API change

Verified: builds default + pyo3, tests pass, cargo publish --dry-run succeeds (19 files, single crate).

After merge — one publish (owner):

cargo publish -p dlpack-rs

🤖 Generated with Claude Code

Fold the `dlpack-sys` crate (bindgen bindings + vendored dlpack.h + build.rs)
into `dlpack-rs` as a private `sys` module. DLPack is header-only (the FFI is
pure structs/consts + fn-pointer types, no native linkage), so no `links`/
sys crate is needed.

Motivation: publishing `dlpack-rs` to crates.io required its `dlpack-sys`
path dep to be a published, versioned crate — but the `dlpack-sys` name is
owned by an unrelated crate. Inlining removes the dependency entirely, so
`dlpack-rs` (which we own on crates.io) publishes as a single self-contained
crate. `cargo publish --dry-run` passes.

- src/sys.rs: `include!("bindings.rs")` + ABI layout test (was dlpack-sys/lib.rs)
- src/ffi.rs: re-export `crate::sys::*` instead of the `dlpack_sys` crate
- build.rs + vendor/ + bindings.rs moved to crate root; `bindgen` opt-in feature
- [lib] doctest = false (bindgen C doc comments carry fenced blocks)
- delete dlpack-sys/; bump 0.3.2 -> 0.3.3. No public API change.

Builds default + pyo3; tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
edgarriba and others added 2 commits July 6, 2026 13:50
… workflow

- regenerate-check: cargo build --features bindgen (was -p dlpack-sys); diff
  src/bindings.rs (was dlpack-sys/src/bindings.rs) after the inline.
- add release.yml: workflow_dispatch, guarded by typing 'publish', runs
  cargo publish for dlpack-rs using the repo's CARGO_REGISTRY_TOKEN secret.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@edgarriba
edgarriba merged commit 13cfa70 into main Jul 6, 2026
14 checks passed
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