/crate-spaces

RFC development area for crates.io namespaces / crate groups / projects / etc.

Crate Space Pre-RFC

What's the best solution for namespaces in the rust ecosystem? After a quick survey of proposals, the one with the most support from team members (though not necessarily the team itself) is a way to group crates into a top level item.

Motivation

Structured Trust. Crate spaces provide a counter balance to the ease of adding dependencies. While easily creating/adding dependencies is nice, it invites a proliferation of crates and deep dependency trees.

There are a couple of factors at play:

  • The rust std is small
  • There is a convention of prefixing extension crates to with the name of the base crate they are for. E.g. json support for serde is serde-json
  • Large disjointed dependency trees are unwieldy from a maintainer point of view

References

There have been several attempts at this:

And the subject has been broached in major threads about crates.io policies

Major Questions and Concerns

  • Referring to namespaced crates in code
  • If we keep the name prefix (very likely?) we'd maybe want (very likely?) a new sigil - would that break macros?
  • Referring to namespaced crates in Cargo.toml
  • Referring to namespaced crates in urls (docs, crates.io and lib.rs)
  • Can they be nested? Can a crate space use another crate space?
  • Who controls crate membership in a cratespace / how it's created
    • When a space is created and owned, and a child made, should it inherit the space owners? Then what if the owner changes?
  • Does the entire crate space get a version, or do you select the individual versions of the crates
  • How non-namespaced crates become namespaced without breaking back compat?
  • Should users just convert crates into crate namespaces and then use features? Could custom cargo metadata be used for display?

Other notes

  • Technically, package.name and lib.name are actually decoupled but usually the same in practice (CAD97)

Alternatives

  • Let people make facade crates themselves (good for cohesion, still bad for auditability)
  • Just use defacto namespace prefixes (e.g. serde-*)
  • An externally maintained list of packages that work together well
  • Allow for defacto metadata in extra Cargo.toml fields that crev can work with