pipx icon indicating copy to clipboard operation
pipx copied to clipboard

pipx install --update

Open gsemet opened this issue 1 year ago • 2 comments

pipx install:

  • install if missing.
  • if available and in the right or wrong version (spec not respected), does nothing

pipx install --force:

  • always reinstall, even if available and if spec respected

pipx update:

  • always update, even when spec is respected
  • if not installed, fail

pipx update --install:

  • always update, even when spec is respected
  • if not installed, install.

What I need is a command that will:

  • if not install, install respecting the provided spec
  • if installed but the spec is not respected, update to the spec, allowing downgrade
  • if installed and spec is respected, does nothing, not even a network connectivity

Example:

$ pipx install --upgrade pylint<7
  • if the current pylint venv respects <7, does nothing.
  • If the current pylint venv does not respect <7, update
  • if no pylint installed, install to version <7

gsemet avatar Nov 07 '24 19:11 gsemet

On the network connectivity, this might be done with https://github.com/pypa/pipx/issues/1275 to allow pipx run do not try to perform any network connectivity when the spec is respected

gsemet avatar Nov 07 '24 19:11 gsemet

Actually, this is also a feature I want. But I would suggest to align with pip install to use --upgrade and --upgrade-stragtegy as options instead.

Contributions are welcome.

huxuan avatar Jan 30 '25 11:01 huxuan

Actually, this is also a feature I want. But I would suggest to align with pip install to use --upgrade and --upgrade-stragtegy as options instead.

@huxuan I'm interested in working on this, but I fail to see how pipx install --upgrade <package> would be any different than pipx upgrade <package>? Or is this just a convenience command to mirror the functionality of pip more closely? I suppose pipx install --upgrade would always install if not exists, whereas pipx upgrade would just error, but that's the only differing functionality between the two comands I can think of right now

j-krl avatar Nov 13 '25 08:11 j-krl