Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crate naming, "features" in Cargo.toml #28

Closed
warner opened this issue Apr 12, 2018 · 2 comments
Closed

crate naming, "features" in Cargo.toml #28

warner opened this issue Apr 12, 2018 · 2 comments

Comments

@warner
Copy link
Collaborator

warner commented Apr 12, 2018

I've been thinking we should publish a couple of different crates:

  • magic_wormhole_core (no IO)
  • magic_wormhole_tokio (yes IO, contains tokio-friendly APIs)
  • magic_wormhole (provides the wormhole CLI tool, so cargo install magic-wormhole; wormhole send works, just like python's pip(si) install magic-wormhole; wormhole send)

But.. now I'm reading about the [features] property in Cargo.toml, and maybe we should use those instead?

  • core feature gets you the sans-io library
  • io-tokio gets you the IO layer that presents a Tokio-friendly API
  • cli gets you the command-line tool

and then we could make all three be the default (so cargo install magic-wormhole gets you a functional CLI). Applications that don't want the CLI (but use Tokio) could use feature=[core, io-tokio] (or however they spell it). And if they want a different IO library, then [core, io-threads] or whatever could work.

We'd have just the one repository, and just the one published crate.

I haven't used these "features" much.. does that seem reasonable?

@copyninja
Copy link
Contributor

Yes this sounds reasonable. Most of the Rust packages uses features where there will be a default feature which is like these are sane defaults and there will be additional features which gives additional stuff. So from your explanation above it feels like core should be default feature and io-tokio is feature when user opts in for tokio dependency.

I'm not fully familiar with wormhole so not sure which should be default feature. i.e core or cli or both core and cli.

Just my 2 cents.

@warner
Copy link
Collaborator Author

warner commented Oct 30, 2018

Ok, based on your comments and those of some other rust folks, I'm gonna aim for this:

  • one crate, named magic-wormhole
  • cargo install magic-wormhole gets you bin/wormhole (Cargo.toml will have a [[bin]] name = "wormhole" with path = "src/bin/main.rs")
  • there are two features, named io-blocking and io-tokio, both on by default
  • apps probably want to add a dependency like magic-wormhole = { version = "0.1", default-features = false, features = ["io-tokio"] }
  • but if they forget, things will still work, they'll just get some spurious dependencies

I still want to see if cargo install magic-wormhole picks up the non-required IO layers, or if the required-features in our Cargo.toml is enough to avoid those.

@warner warner closed this as completed in 35ca374 Oct 30, 2018
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

No branches or pull requests

2 participants