-
Notifications
You must be signed in to change notification settings - Fork 34
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
Improving binary distribution through cargo. #20
Comments
I'm unsure if Granted, having prebuilt tarballs and using trust is much preferred. |
Kind of like our defining what is in scope for this working group by defining a CLI, I think it'd be important for us to define what we think is the scope of One way of doing this is to evaluate what are our packaging and distribution requirements, consider what the ideal solutions are (like my CI use case is solved better if its easy to make prebuilt binaries), and then see what is left for |
@epage
I thought with separating out this issue into its own we'd remove the idea that building out packaging and distribution comes at odds with building out |
Ok, I thought the value of splitting this out from #8 was because of how different the overall discussions would be. #8 is about documentation, tooling, package formats to support, and policies related to those formats. A discussion on
I feel like attempting what you are describing is ambitious enough that it would at least start life as a research project that is a cargo plugin. Instead of just having this one issue, I wonder if we should address two things (1) a cross-platform cargo-integrated software distribution method and (2) narrow, concrete use cases for Additionally, I personally feel like the
Is there something unique to Rust that having control over the packaging scheme benefits us? I'm wondering what advantage this provides us. |
@epage I think you've misunderstood what I'm proposing. Cargo wouldn't distribute binaries, cargo would still just build from source and be placed in the Just because you skip over |
I think part of my misunderstanding came from:
That implies a scope to handle all problems including
Those I described above can involve some platform-specific criteria.
It looks like npm is being held up as an example. Could you document it for this discussion. What requirements does it handle? How does it meet those requirements? That might be a big help in understanding what you meant by your earliest comments so we can get on the same page. |
I'm not sure I follow here. I would assume that I agree with everything else though. On the more general topic of However, having said all that, my argument is against trying to make If you're releasing tools designed for Rust development, then sure, I think These are just my personal opinions and I'm not in charge of |
To add context here, standard ripgrep releases do actually strip the binary of debug symbols. Debug info is enabled in the release profile because many of the things I debug in ripgrep are performance problems, and I therefore need to compile in release mode. Since I'm debugging, I also want debug symbols. There is somewhat of a conflation here in that I'm using "release mode" as "compile with optimizations," but, invariably, that's what release mode is. If there were some additional profile that was "compile with optimizations," then I would use that and probably disable debug symbols in the actual "release" profile. If ripgrep had a high incidence of bugs that caused panics (it doesn't), then I might reconsider this and be more aggressive about including debug symbols in released binaries. I could also just tweak the I don't have many opinions about the wider issue though. Weakly held, it doesn't seem like something I would personally prioritize to be honest. I'd be much more interested in smoothing out the release process for end users that don't care about Rust, because that is by far a much harder task, and maintainers need all the help they can get there. |
I forgot - when I keep mentioning guides and how-tos for release centric tools and native repos it's because that's step one.
If we start with step 2, only a select few may have the knoweldge to contribute. If we start by teaching, the world of open source opens up. I say this because I don't personally know how to release a Again, just my methodologies behind my thoughts 😄 |
Most of applications written in Rust don't require VM/interpreter/etc to work, right. It is a system programming language. Thus said we shouldn't require users to install, maintain and learn Rust's build/packaging toolchain to consume applications written in Rust. There are hundreds of programming languages, imagine if every one of them would require you to have own build tools and package managers just to install an app 😸 Tbh it's unfortunate that Cargo and Crates.io support not only library distribution/consumption but also executables. I guess since it does support executables atm, we need to answer "Should it continue supporting distribution/consumption of executables or not?" first as we seem to have different opinions on allocating resources for improving Cargo/Crates support for executables. And then depending on the answer either implement most of the improvements suggested in this issue or deprecate that support and focus on providing better support for system package managers. Potential negative side-effect of improving Cargo/Crates support for executables I see is that Rust developers will tend to rely on that thus spreading the feel of complicated/non-standard setup required to install and update applications written in Rust even though technically there are no reasons for that. |
@artem-zinnatullin Cargo can't ever walk back allowing binary distribution too many crates depend on that being available. Why do you think this is being proposed as a replacement to traditional distribution. This hasn't ever been said in this thread and in fact I have clarified multiple times that, this is intended as an improvement for Rust developers. Rust developers have cargo, being able to easily cross platform install tools and apps is a great convenience to them. It allows developers to easily get early feedback from other Rust developers. |
This gets back to my more clearly defining scope. While targeting this at Rust developers might have been the intention, it didn't come across that way for me until this comment. I think one area people might be confused is:
Looking back at it now, I wonder if you intended this to mean they are familiar with using cargo and so would be comfortable getting apps through it. I had read it as them being familiar with packaging with cargo and could distribute apps through it. |
Okay, I've gone back and rewritten the original post to give a much clearer sense of direction and hopefully clear up any ambiguity in the text. |
Summary / Motivation
The current
cargo-install
user experience is very poor. For both the user's(people using
cargo-install
) and the developer's (people publishing binariesthrough
cargo-publish
). For example having no upgrade story, having no wayto separate dependencies between libraries and binaries, and having no awareness
of binaries on the crates.io website.
CLI applications are currently the third most popular category
on crates.io. From general purpose tools like ripgrep, tokei, and hyperfine,
to rust development tools like the [diesel CLI], to the myriad of cargo plugins
which one of the biggest categories on crates.io. Despite crates.io initially only
being designed for libraries it's clear that people want to use it to distribute and
share Rust applications.
Cargo and the crates.io is a lot of developer's first distribution of their CLI
application. Improving this experience helps smooth out building a CLI
application to rust by having a complete distribution experience out of the box
with Cargo.
Upgrading
The is no current way in cargo to upgrade a binary. The user's options are to
run
cargo install --force <package>
orcargo uninstall <package> && cargo install <package>
. The problem with both ofthese options is that neither respects the currently installed package's version
so to upgrade a cargo package requires a complete reinstall of the application
regardless of whether there is a newer version.
This is a very poor experience as Rust developer's we know how long Rust release
compile times are. Even with with all the great work the compiler does to reduce
compile times there is no better compile time than having to not compile at all.
Cargo should provide upgrade functionality either through a new subcommand a la
brew upgrade <package>
or through a flag like pippip install -u <package>
.Separation of dependencies
Currently cargo allows you to specify the developer's intent of a dependency
with
[dev-dependencies]
allowing a developer to use different dependencies fordevelopment that the end user of their library or application doesn't need to
download or worry about compiling for their system.
cargo-install
does notrespect this and will download and build these packages.
Cargo currently does not have the ability to separate dependencies for binaries
and libraries. While at first this doesn't seem like a big issue since a binary
that depends on the library has to get all of their dependencies. This becomes
a problem for the reverse libraries downloading their binary's dependencies.
Which becomes an issue when installing a CLI through
cargo-install
.Cargo should provide a way to specify library or binary specific dependencies.
This could be done in a similar way to development dependencies and having
[lib-dependencies]
,[bin.dependencies]
, and[bin.bin_name.dependencies]
which would allow developer's specify which packages are used only for libraries
or binaries while retaining the current behaviour and having
[dependencies]
befor crates that used in all.
It might not be a big deal to get these packages but they do add a non trivial
amount of compile time. We also should not be wasting a user's bandwidth there
is still a lot of situations where bandwidth is tight whether the user lives in
an area with poor service or is using cellular which are no where near the
level's of bandwidth or stability, so any reduction of data is a
big improvement.
Showcasing applications
Currently crates.io only shows instructions on how to add a crate as library
dependency. Cargo should show
cargo install <package>
for binary only, andshow other binaries that are part of that crate.
Unresolved questions
The text was updated successfully, but these errors were encountered: