jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.28k stars 219 forks source link

fix: sort pipx forge remote versions semantically #2182

Closed jasisk closed 1 month ago

jasisk commented 1 month ago

Seems pypi sorts releases lexically which can result in the wrong version being selected for latest in the pipx forge. Example

Noticed this when attempting to use pipx:magic-wormhole which would install v0.9.2 instead of v0.14.0.

Just like the last time I was in here, I'm not a rust person and just kinda fumbled my way through (and didn't write any tests!) so please destroy at will.

Previous behavior:

$ mise x pipx:magic-wormhole -- wormhole --version
creating virtual environment...
creating shared libraries...
upgrading shared libraries...
installing magic-wormhole from spec 'magic-wormhole==0.9.2'...
done! ✨ 🌟 ✨
mise pipx:magic-wormhole@0.9.2 ✓ installed                                                                                                                                                                                         magic-wormhole 0.9.2

New behavior:

$ cargo run x pipx:magic-wormhole -- wormhole --version
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
     Running `/tmp/mise/target/debug/mise x 'pipx:magic-wormhole' -- wormhole --version`
creating virtual environment...
creating shared libraries...
upgrading shared libraries...
installing magic-wormhole from spec 'magic-wormhole==0.14.0'...
done! ✨ 🌟 ✨
mise pipx:magic-wormhole@0.14.0 ✓ installed
magic-wormhole 0.14.0
jasisk commented 1 month ago

... thank goodness for those e2e tests. As mkdocs shows, assuming they're all valid semantic versions was a bad assumption on my part. 🫤 Next approach might be to add a version entry for latest based on what .info.version is set to from pypi, or maybe sorting releases by upload date? Maybe pull in pep440_rs and sort that way? I'm not a huge fan of any of those but they're the best ideas I've got right now.

jasisk commented 1 month ago

Fixed by #2209