Code Monkey home page Code Monkey logo

psvm's Introduction

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.

If you want to check if the dependencies in your local Cargo.toml file are matching to a specific Polkadot SDK version, you can use the -c or --check flag along with the --version flag followed by the version you want to check against.

If you want to update the ORML crates in your local Cargo.toml, you can use the -O or --orml flag along with the --version flag to update the ORML crates along with the polkadot-sdk crates. This works only if the supplied version is present in the ORML releases.

# 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
# Check against a particular Polkadot SDK version without updating the Cargo.toml file
psvm -v "1.4.0" -c
# Update the ORML dependencies along with the Polkadot SDK dependencies.
psvm -v "1.6.0" -O

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.

psvm's People

Contributors

0xsouravm avatar ggwpez avatar patriciobcs avatar rzadp avatar shawntabrizi avatar smiasojed avatar dependabot[bot] avatar

Stargazers

 avatar Marcel Ebert avatar Nuke 🌄 avatar Konrad Stepniak avatar  avatar Martin Barreto avatar Deepak Chaudhary avatar 0x avatar Thanos Doukoudakis avatar Raj Raorane avatar Ivan Subotic avatar eNddy avatar Luis Enrique Muñoz Martín avatar William Freudenberger avatar Sebastian Kunert avatar Adrian Catangiu avatar Amar Singh avatar Valery Gantchev avatar Alex Won avatar Javier Viola avatar  avatar Sergej Sakac avatar  avatar Tony Riemer avatar Juan Girini avatar Dino Pačandi avatar  avatar Panagiotis Ganelis avatar Kian Paimani avatar  avatar Alejandro Martinez Andres avatar GENGE avatar PG Herveou avatar

Watchers

Andrew Jones avatar Michael Müller avatar Koute avatar Gonçalo Pestana avatar  avatar Anton Vilhelm Ásgeirsson avatar  avatar Nikolay Volf avatar  avatar Kian Paimani avatar Sebastian Kunert avatar Egor_P avatar Wei Tang avatar Davide Galassi avatar Branislav Kontur avatar Arkadiy Paronyan avatar Ankan avatar  avatar Alin Dima avatar Ignacio Palacios avatar ddorgan avatar Georgiy Komarov avatar  avatar Ross Bulat avatar Niklas Adolfsson avatar Lulu avatar gupnik avatar Gherman avatar Serban Iorga avatar  avatar Alexandru Gheorghe avatar

psvm's Issues

3rd party pallet support (e.g. ORML)

Is it possible to make psvm also supports other pallets like ORML? In that way it can identify the right version of ORML to use.
Happy to do whatever needed on ORML side to make this possible.

Support the new `polkadot-sdk` release process

Currently, the tool is looking at release-crates-io-v* branches.

"{}/paritytech/polkadot-sdk/release-crates-io-v{}/{}",

But the new release process has introduced some changes to it.

We should update psvm to support the new release process.

It also means that there is no such straightforward conversion from a desired version (e.g. 1.14.0) into a branch name containing relevant Plan.toml&Cargo.lock (used to be release-crates-io-v1.14.0).

tag releases make a release

Trying to use psvm to install the new stable and doesn't work.
Found out that I need to install from github master and need to read the code to figure out what's the version name because -l don't have it (#19).
Please tag releases for psvm and make releases to ensure the released version works with latest released polkadot-sdk.

fetch versions mapping online

I don't want to reinstall psvm for every new polkadot-sdk release. It just doesn't make sense.
It should discover the new release mapping and just works with the new release as soon as it is released.

and wen 1.10.0?

Possible Missed Package jsonrpsee

First of all this is amazing, made updating substrate super easy. However I did have it miss jsonrpsee update. Not sure if there is a reason or was just an oversight

`--check` option

I would like to use psvm in my CI workflow to ensure the correct dependency versions are used. It would be good to add a --check flag that exits with a non-zero status code if the dependencies need updating.

List and document stable versions

Following #17

The PR allows using stable versions, so now we can list them when using psvm -l. This is useful specially for new devs that are not aware of which version to use. In the same way, It would be useful to document this new versions in the readme.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.