Skip to content

Direct link to download published crate sources #1592

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

Closed
dhardy opened this issue Jan 10, 2019 · 8 comments
Closed

Direct link to download published crate sources #1592

dhardy opened this issue Jan 10, 2019 · 8 comments
Labels
A-frontend 🐹 C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works wontfix

Comments

@dhardy
Copy link

dhardy commented Jan 10, 2019

A couple of times now I have wanted to download the source for a published crate. Sometimes a link to the code repository is all you need, but sometimes the link is missing (or there isn't even a published repository), and sometimes you need to inspect the exact code of a release.

Since Cargo publications are just source tarballs, inspecting the .crate files is easy if you can get them, however apparently the only way to do this is to make Cargo download the crate as a dependency, then retrieve it from Cargo's cache.

Summary: add a direct download link for each published .crate file.
Related: #193

@sgrif
Copy link
Contributor

sgrif commented Jan 10, 2019

I don't think this is a common enough need to justify a link on the website. You can download any crate by just going to crates.io/api/v1/crates/crate_name/vers/download (e.g. https://crates.io/api/v1/crates/diesel/1.3.3/download)

@dhardy
Copy link
Author

dhardy commented Jan 11, 2019

Thanks, but that's quite a URL to remember. I would prefer a link on the page (or maybe under the "all versions" page).

@Turbo87
Copy link
Member

Turbo87 commented Dec 6, 2020

as described in e.g. #2113 and some of the other linked issues, our official recommendation is to use tools like https://github.com/JanLikar/cargo-clone to download the raw source of crates if you need them, or use our API endpoint for it directly.

since the mainstream way of downloading crates is always going to be cargo usage, a prominent "Download" button on the page could cause quite a bit of confusion to our users. since downloading a .crate file manually is a relatively uncommon thing and there are already cargo plugins that allow this, we don't think the tradeoff of having such a button is worth it.

@Turbo87 Turbo87 closed this as completed Dec 6, 2020
@Turbo87 Turbo87 added the wontfix label Dec 6, 2020
@pragmatrix
Copy link

a prominent "Download" button on the page could cause quite a bit of confusion to our users

Agreed, but there is also lies the solution, don't make a download button prominent. The users needing it will find it, the ones who don't, won't be confused.

@Turbo87 Turbo87 added C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works and removed C-feature-request labels Feb 11, 2021
@WhyNotHugo
Copy link

since downloading a .crate file manually is a relatively uncommon thing

How do you typically review code before you run it locally if not by downloading the tarball?

@eth3lbert
Copy link
Contributor

How do you typically review code before you run it locally if not by downloading the tarball?

I have shown two approaches for inspecting the contents at #10754 (reply in thread).

@WhyNotHugo
Copy link

Navigating through HTML renders of a codebase is hardly a convenient way to read an entire codebase. Don't you really not use a code editor or IDE?

Both of these options seem like (rather hacky) workarounds, but are not substitute for a simple "download" button.

@WhyNotHugo
Copy link

WhyNotHugo commented Mar 31, 2025

FWIW, most other package repositories include links to download tarballs, even though they are not necessary when using a package manager. Some random examples:

It doesn't need to be a huge prominent link, just something that's findable with ctrl+f would suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works wontfix
Projects
None yet
Development

No branches or pull requests

7 participants