Skip to content

paritytech/psvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Polkadot SDK Version Manager

This is a simple tool to manage and update the Polkadot SDK dependencies in any Cargo.toml file. It will automatically update the Polkadot SDK dependencies to their correct crates.io version.

Installation

From GitHub:

cargo install --git https://github.com/paritytech/psvm psvm

From crates.io:

cargo install psvm

Usage

Go to the directory containing the Cargo.toml file you want to update and run psvm. This will automatically update the Polkadot SDK dependencies in the Cargo.toml file to their correct crates.io version.

If you want to update the local dependencies (using path="..."), you can use the -o or -overwrite flag, this will remove the path and set a crates.io version instead.

If you want to update the dependencies to a specific Polkadot SDK version, you can use the -v or --version flag, followed by the version you want to update to.

# Go to the directory containing the Cargo.toml file you want to update
cd <cargo-toml-dir>
# Update to a specific Polkadot SDK version
psvm -v "1.3.0"
# You can also update an specific Cargo.toml file by passing its path
psvm -v "1.4.0" -p <cargo-toml-dir>/Cargo.toml
# Overwrite local dependencies (with same name as Polkadot SDK crates) with crates.io versions
psvm -v "1.7.0" -o
# List all available Polkadot SDK versions
psvm -l

Listing all available Polkadot SDK versions requires querying the GitHub API, so your IP may be rate-limited. If a rate limit is reached, the tool will fallback to the GitHub CLI to list the versions. Ensure you have the GitHub CLI installed and authenticated to avoid any issue.

Workflow

To update a Cargo.toml, the tool will fetch the Plan.toml file (used to publish crates into crates.io) from the release branch in Polkadot SDK associated to the version input (--version argument), generate a mapping (crate -> version) filtering all crates that were not published in this released (i.e. publish = false) but keeping the crates published by parity-crate_owner (even if they were not published in this release), and overwrite the input Cargo.toml file to match the version from the mapping (i.e v1.6.0 Plan.toml).

In specific versions, the Plan.toml file may not exists (i.e. v1.3.0). In this case, the tool will fallback to the Cargo.lock file (i.e. v1.3.0 Cargo.lock) from the branch, generate a mapping using this file and overwrite the input Cargo.toml file to match the version from the mapping. The only concern to be aware in this scenario is that the Cargo.lock file may contain dependencies that are not published in crates.io, and the tool will not be able to filter them out cause it is not possible to determine if a crate is published or not (with this file). If you have a local dependency with a name similar to a crate not published, the tool will overwrite it, so be careful. Currently, this only happens with v1.3.0, but as the branches can change at any time, it is important to be aware of this. The tool will alert with a message "Failed to get Plan.toml, falling back to Cargo.lock." if this happens.

About

Polkadot SDK Version Manager

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages