Publish the crates in the Rust SDK
Closed this issue · 3 comments
If we want the Rust SDK to be maximally usable within the rust ecosystem, we should publish our crates on crates.io
.
I've done some research on it and I don't think it makes sense to publish the rust sdk to crates.io
at this time.
-
The standard Rust ecosystem does not currently support publishing an entire workspace, but rather
cargo publish
only works on individual packages. The package must be valid considered by itself, allowing for dependencies that are published ahead of it. -
In our case,
hyperdrive-wrappers
usesbuild.rs
to clone the hyperdrive repo & build the wrappers. I could not find any way to make this compatible with a workflow to upload the wrappers as a crate.
Instead, I think we should include a recommendation to install from github in the README:
cargo add hyperdrive-rs --git https://github.com/delvtech/hyperdrive-rs
And we should upload the docs manually to whatever hosting service we choose.
after talking with @jalextowle and @ryangoree it seems we do want to try to publish to crates.io
It's lame to upload all the wrappers (which is what we were eager to avoid in the first place), but worth it to have everything online & easy to work with.
here are the steps I've identified so far
-
rename
fixed-point
tofixedpointmath
(unfortunatelyfixed-point-math
&fixed-point
were taken) -
set workspace references for package details
version = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
documentation = { workspace = true }
repository = { workspace = true }
description = { workspace = true }
- set global workspace dependencies in
./Cargo.toml
[workspace.dependencies]
fixedpointmath = { version = "0.16.2", path="crates/fixedpointmath" }
hyperdrive-wrappers = { version = "0.16.2", path="crates/hyperdrive-wrappers" }
hyperdrive-math = { version = "0.16.2", path="crates/hyperdrive-math" }
- set package ref dependencies to workspace, e.g. in
crates/hyperdrive-math/Cargo.toml
:
# Workspace dependencies
fixedpointmath = { workspace=true }
hyperdrive-wrappers = { workspace=true }
Next we need to publish crates in order via cargo publish in a github action, or maybe we can use something like cargo-release
. Looking into this now.
I ended up automating the publish in a workflow/script combo on tag pushes instead of using cargo-release
. This is how all of the python package releases work. It seems to be a solid enough system.