DEV Community

Gerardo Enrique Arriaga Rendon
Gerardo Enrique Arriaga Rendon

Posted on

Publishing yassgy to crates.io

This time, I would like to talk about publishing yassgy to crates.io, and the process I went through, in the case there is a fellow developer who is going to publish their application.

Publishing a crate, what is a registry?

If it is the first time you hear about the word, a registry is, as it name entails, a list of entries used for referential purposes. This might be too of a general answer, so let me narrow it to the topic at hand: a registry like crates.io is a list of packages, which you can refer to download packages from, which can include binary crates (regular applications) or a library crate.

Setting up the package for publishing

Publishing a package with cargo is very easy, and it requires very minimal configuration.

Although the cargo book goes in a very thorough explanation about every little detail about cargo, you might not be interested on all the details when starting out. Thus, I would like to explain what I had to do.

Most of the changes would be done in Cargo.toml generated when creating a project using cargo new. There are several values that you might need to add to your Cargo.toml; some of them are the license your program uses (in my case, I wrote the MIT license), a small description of the package, and a URL to the repository of the package. Other files you might want to reference is the "exclude" list of values, where each value is a pattern to a file to not include during packaging. In my case, I included the following values: testfiles/*, tests/*, .vscode, rustfmt.toml, .git*. This can decrease the total size of the package that will be uploaded to crates.io.

After that, you may check whether there are no issues before actual publishing, by running the command:

cargo publish --dry-run
Enter fullscreen mode Exit fullscreen mode

and you can also check what files are being included in the package by running the command:

cargo package --list
Enter fullscreen mode Exit fullscreen mode

Making a release on GitHub through tags

After making sure that the packaging was fine, I decided to make a GitHub release by tagging the latest commit available in the master branch.

I ran the following command:

git tag -a v0.1.0 -m "Initial release"
Enter fullscreen mode Exit fullscreen mode

to create the tag on the master branch, and then I pushed the tags with

git push --follow-tags
Enter fullscreen mode Exit fullscreen mode

Then, I created a new GitHub release with the v0.1.0 tag.

Finally, I published my package to crates.io with the following command:

cargo publish
Enter fullscreen mode Exit fullscreen mode

You can view the crates.io page here.

Installation

To install yassgy, you would need Rust and cargo, since cargo downloads the source code, which then gets compiled in the computer of the user.

The command to install yassgy is the following:

cargo install yassgy
Enter fullscreen mode Exit fullscreen mode

It doesn't get simpler than that.

Conclusions

Releasing yassgy was an interesting experience, since this is the first time I have openly released software to the world intentionally. I have to admit that I am not fully satisfied with the capabilities of yassgy, but I am sure that I will be able to upgrade yassgy and improve it to the full view I have for it.

Top comments (0)