#cargo #cargo-plugin #prepublish

app cargo-prepublish

A cargo plugin to help prepare a crate for publishing to Crates.io

6 releases

0.1.5 Feb 20, 2023
0.1.4 Feb 17, 2023

#285 in Cargo plugins

Download history 8/week @ 2023-11-04 1/week @ 2023-11-11 1/week @ 2023-11-18 32/week @ 2023-11-25 7/week @ 2023-12-02 6/week @ 2023-12-09 2/week @ 2023-12-16 12/week @ 2023-12-23 6/week @ 2023-12-30 1/week @ 2024-01-13 2/week @ 2024-01-20 24/week @ 2024-01-27 25/week @ 2024-02-10 96/week @ 2024-02-17

145 downloads per month


563 lines


crates.io docs

A Cargo plugin to help setup and prepare a Crate before publishing.

How Does it work?

It reads your cargo.toml file and based on the values not present it will either set defaults or prompt you for input.

Some of the prompts will be required and others optional.


Git is required to be installed as tool uses the command line to run git commands.

How to use

cargo install cargo-prepublish

# To make changes to the Cargo.toml file
cargo prepublish

# To make changes to the Cargo.toml file with just the defaults and not interactivity
cargo prepublish -n
# OR
cargo prepublish --non-interactive

# To check if the Cargo.toml is valid
cargo prepublish -v
# OR
cargo prepublish --valid

What are the checks

It checks the following

  • categories: If it doesn't exists then an empty array is added with a comment to the docs
  • description
  • documentation (Optional) Crates.io will link it to docs.rs automatically
  • homepage: Uses git repo as the default if not set or entered
  • keywords: At least one keyword needs to be entered. Default is the package name
  • license and license-file: The default is license MIT OR Apache 2.0
  • readme: Will first look for an existing one and if not, then one will be generated
  • repository: Will extract for git if a valid git repo
  • authors: Optional

Extra checks

  • package.metadata.docs.rs.all-features: This will only be applied for when a crate has features


  • Scattered array of tables (tables are reordered by default by toml_edit)


Any contributions are welcome. If you find a bug, have a suggestion or feature request, please open a issue.


~155K SLoC