Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should end user utilities/applications be registered on crates.io?

Is it acceptable to register generally useful (utilities / applications) on crates.io?

The FAQ doesn't address this and from browsing, there are examples of end-user applications (mostly command line tools).

Or is crates.io? meant only for libraries?


I'm asking this because the documentation hints at library use, semantic versioning for API's etc. but doesn't reference the case for packaging applications explicitly.

like image 723
ideasman42 Avatar asked Oct 27 '16 05:10

ideasman42


People also ask

What is crates io?

Crate.io is a company of passionate, experienced team members who develop solutions for today's fast, data-intensive world.

Is crates IO open source?

The crate registry at crates.io distributes the source code of your packages, so it primarily hosts code that is open source.

How do I publish crate io?

Publishing a new version of an existing crate In order to release a new version, change the version value specified in your Cargo. toml manifest. Keep in mind the SemVer rules which provide guidelines on what is a compatible change. Then run cargo publish as described above to upload the new version.


2 Answers

Yes, because you can use cargo install to install and manage those applications system-wide. If this use were discouraged, I would suspect that command to not exist at all, or at least have a very limited applicability.

Snippet from cargo install --help:

Usage:

 cargo install [options] [<crate>]
 cargo install [options] --list

[...]

This command manages Cargo's local set of installed binary crates. Only packages which have [[bin]] targets can be installed, and all binaries are installed into the installation root's bin folder. The installation root is determined, in order of precedence, by --root, $CARGO_INSTALL_ROOT, the install.root configuration key, and finally the home directory (which is either $CARGO_HOME if set or $HOME/.cargo by default).

There are multiple sources from which a crate can be installed. The default location is crates.io but the --git and --path flags can change this source. If the source contains more than one package (such as crates.io or a git repository with multiple crates) the <crate> argument is required to indicate which crate should be installed.

like image 95
Kroltan Avatar answered Nov 15 '22 09:11

Kroltan


This should not be the primary reason to publish an application to crates.io, but I'm listing it here because it's still a good reason. :)

The Rust team will occasionally use a tool called crater to check for regressions on all crates published on crates.io, usually before merging a pull request that has uncertain consequences. If you wrote some code that happens to compile today but would stop compiling1 due to a bug fix in the compiler, then they may even submit a pull request to your project that fixes your code!


1 Usually, when such breaking changes occur, there's at least one prior release in which a warning will be reported before the warning is turned into an error.

like image 26
Francis Gagné Avatar answered Nov 15 '22 09:11

Francis Gagné