Donation link in Cargo.toml?

Lately I heard about the website of clap.rs, and I noticed that it has a sponsorship page, which is something I wasn't aware of before.

That made me think that it may make sense to add a "donation" field into Cargo.toml's package section, linking to this kind of sponsorship page, or just the link to pay (like paypal.me). With this available, tools can be developed to list all crates in your dependency tree which accepts donation, and people interested in supporting the Rust ecosystem would have an easier way to help the authors and maintainers.

WDYT?

3 Likes

The package.metadata namespace is available to start prototyping this tooling without having to go through the RFC process, first step would be to just throw together an initial proposal of keys and supported values and get some mindshare behind it

[package.metadata.donation]
link = "https://paypal.me/givemecoin"
zcash = "44aReVLawb3YHKZR5htDN"

If it then proves popular enough to become first-party it would be easy to have tooling that supports reading from both a standard key and a package.metadata key while the ecosystem transitions.

2 Likes

That sounds reasonable.

My initial thought is that it would just link to an arbitrary page rather than providing the specific information for each donation channel. That's because different projects may have different donation mode. Some may have members accepting donation separately, some accept as an organization. Also there may be recurring and one-off links.

Isn't this already somewhat a thing with the badges you can specify? I wouldn't be surprised if there's already badges you can use for donations.

I would love to see "sponsorship" metadata, which crates.io could provide as a link.

Long-term, it'd be nice to be able to handle that more automatically ("help me sponsor all the crates I use"), but short-term, a single URL seems like an improvement.

One other thing I'd like to have in that regard, though: could crates.io also support associating such a URL with an author, and have a setting to automatically associate that URL with all crates owned by that author? That wouldn't preclude also setting the per-crate metadata, but it would simplify the common case.

3 Likes

"Sponsor all crates I use" sounds like a great feature.

There's also https://liberapay.com, GitHub sponsors, Patreon. It'd be nice if all these methods could be specified for programmatic use somehow, so that e.g. I can add all authors to my liberapay sponsorships automatically.

2 Likes

Automating it is probably non-trivial. There are several thing I can currently think of:

  • One-off vs. recurring.
  • People may have different donation start level for recurring donation ($1, $3, $5, etc.).
  • A project may have multiple maintainers. (Are they all the same?)
  • A maintainer may have multiple crates. (Maybe you want to donate them more in that case?)
  • There may be crates you actually never use due to feature / platform.

Those all need to be explored.

But yeah, maybe we can start with the metadata, and then we can see what can be done with it.