jdx / mise

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

'pipx' backend with 'latest' target picks wrong release for prerelease versions #2202

Closed eblume closed 4 months ago

eblume commented 4 months ago

Describe the bug

When targeting a project which has not yet hit 1.0, it appears that mise is picking the highest-sorted member using lexicographic sorting rather than alphanumeric sorting, and thus for the package llm (a CLI utility) it chooses 0.9 instead of the most current release (as of this writing), 0.14. Because 0.9 contains a showstopping bug (a missing core dependency), the resulting CLI always crashes.

My current workaround is to specify a release manually (in this case, pipx:llm@0.14).

To Reproduce

➜ mise use -g pipx:llm
creating virtual environment...
creating shared libraries...
upgrading shared libraries...
installing llm from spec 'llm==0.9'...
done! ✨ 🌟 ✨
mise pipx:llm@0.9      ✓ installed                                                                                                                                                 mise ~/.config/mise/config.toml tools: pipx:llm@0.9

➜ llm --version
Traceback (most recent call last):
<...snip...>
ModuleNotFoundError: No module named 'requests'

➜ mise uninstall pipx:llm
mise pipx:llm@0.9      ✓ uninstalled

➜ mise use -g pipx:llm@0.14
creating virtual environment...
creating shared libraries...
upgrading shared libraries...
installing llm from spec 'llm==0.14'...
done! ✨ 🌟 ✨
mise pipx:llm@0.14     ✓ installed                                                                                                                                                 mise ~/.config/mise/config.toml tools: pipx:llm@0.14

➜ llm --version
llm, version 0.14

Expected behavior

mise use -g pipx:llm && llm --version should print "llm, version 0.14"

mise doctor output

version: 2024.5.23 macos-arm64 (2024-05-27)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Mon, 27 May 2024 14:49:04 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
  Profile: release

shell:
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:
  ~/.config/mise/config.toml
  ~/.mise.toml

backends:
  cargo
  core
  go
  npm
  pipx
  ubi

plugins:
  bun        (core)
  deno       (core)
  erlang     (core)
  go         (core)
  java       (core)
  node       (core)
  poetry     https://github.com/mise-plugins/mise-poetry.git#431c335
  python     (core)
  ruby       (core)
  terraform  https://github.com/asdf-community/asdf-hashicorp.git#f1602b6
  zig        (core)

toolset:
  python@3.12.3
  node@22.2.0
  go@1.22.3
  ruby@3.3.1
  pipx:yamlfix@1.9.0
  pipx:bashate@2.1.1
  pipx:ruff@0.4.5
  pipx:poetry@1.8.3
  pipx:pre-commit@3.7.1
  pipx:llm@0.14
  pipx:pyright@1.1.364
  npm:yaml-language-server@1.14.0
  npm:cspell@8.8.3
  npm:bash-language-server@5.3.3
  npm:readability-cli@2.4.5
  npm:neovim@5.1.0

env_vars:
  MISE_SHELL=zsh

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = true
  python_default_packages_file = "/Users/erichdblume/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context This could be intended behavior, but perhaps should surface a warning?