bulletmark / pipxu

Install and Run Python Applications in Isolated Environments using UV
101 stars 1 forks source link

Ability to pass arguments to uv pip when upgrading a package #5

Closed Nardol closed 6 months ago

Nardol commented 6 months ago

To compare with pipx, if I want to update something to a pre-version, I can run pipx upgrade --pip-args=--pre <package> I have not found how to do the same with pipxu. I tried with run-pip but I had the message specifying "--prerelease=allow" is a wrong parameter passed to pipxu.

Could it be possible to allow this situation? Allowing to pass arguments to uv pip E.G. when upgrading.

bulletmark commented 6 months ago

I don't want to complicate pipxu with too many obscure arguments and options. However the runpip command ultimately allows you to do anything, if you know what you are doing. Note it is runpip not run-pip in both pipxu and pipx. See the usage/help output for the runpip command (or in the main README here):

$ pipxu runpip -h
usage: pipxu runpip [-h] package [args ...]

Run pip with given arguments on virtual environment for the given application.

positional arguments:
  package     installed application name
  args        arguments to pass to uv pip, should start with "--".

options:
  -h, --help  show this help message and exit

I. e. you need to start the arguments to pip with -- so pipxu knows where it's own arguments end (which are all error checked etc), and those external pip arguments start (which can be anything). This is actually a common technique you will find in other programs that do similar parsing of external args to pass on.

Nardol commented 6 months ago

I used auto-completion so used runpip but miss-typed it, sorry. I better understood when you explained -- usage and succeeded in passing -U --prerelease=allow so pipxu runpip esphome -- install -U --prerelease=allow esphome to upgrade to the latest beta version. Thanks for your help.