You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am considering using pipx as the primary tool for distributing and installing locally-developed applications on our workstations. As such, what I [think I] want is a way to invoke pipx from scripts to install applications, in a way that is idempotent and achieves the installation as specified, regardless of what software is already installed (or not) by pipx.
where <pip-spec> can be any specifier that can be supplied to pip (a local path, a Git URL, etc). In a script I won't have anything more than that to supply to the command, and so the rest must be derived from the given information. (Obviously no challenge for pipx, yet.)
The objective: From a command like the above I'd like to end up with the application installed at the latest version possible from the given specification, with the requested python interpreter, regardless of whether or not it was installed before or installed differently with pipx. I don't see any means to achieve this currently.
I initially thought about doing it by scripting around pipx to figure out whether to invoke it with install or upgrade or reinstall and so forth, using pipx list --short to inquire about already installed packages, and even finding and parsing the various pipx_metadata.json files to establish associations between installed distribution names and pip specifiers. But going the other way (from possibly-not-yet-installed pip specifiers to distribution names) appears to be a hard problem and I see pipx is already going to great lengths to do this (installing in a temporary venv and listing the installed package to get the name, wow), so it started to make more sense to think of this as a feature that could/should be added to pipx itself.
Some thoughts on the desired behavior:
If the application is not installed, install it.
If the application is installed with the requested Python interpreter, check the application version and if it matches what would be installed then no-op by default
If the installed version is lower, upgrade
If the installed version is higher for some reason, downgrade or reinstall
If the application is already installed but with a different Python interpreter, reinstall
In all above cases, return a zero to the shell. Return nonzero only on an unresolvable operational error.
If this is something anyone else might want ... should it be implemented as an option to the install command, or a separate command, or an enhancement to the default functionality of install (rather than generating an error)? Would anyone be interested if I worked on a PR for a feature like this? Are there confounding or complicating use cases I'm not considering?
Or have I missed an existing feature that would already do what I'm looking for?
The text was updated successfully, but these errors were encountered:
I am considering using pipx as the primary tool for distributing and installing locally-developed applications on our workstations. As such, what I [think I] want is a way to invoke pipx from scripts to install applications, in a way that is idempotent and achieves the installation as specified, regardless of what software is already installed (or not) by pipx.
I'd like to be able to, for example:
sudo pipx install --global --python /usr/local/bin/python3.12 <pip-spec>
where
<pip-spec>
can be any specifier that can be supplied to pip (a local path, a Git URL, etc). In a script I won't have anything more than that to supply to the command, and so the rest must be derived from the given information. (Obviously no challenge for pipx, yet.)The objective: From a command like the above I'd like to end up with the application installed at the latest version possible from the given specification, with the requested python interpreter, regardless of whether or not it was installed before or installed differently with pipx. I don't see any means to achieve this currently.
I initially thought about doing it by scripting around pipx to figure out whether to invoke it with
install
orupgrade
orreinstall
and so forth, usingpipx list --short
to inquire about already installed packages, and even finding and parsing the various pipx_metadata.json files to establish associations between installed distribution names and pip specifiers. But going the other way (from possibly-not-yet-installed pip specifiers to distribution names) appears to be a hard problem and I see pipx is already going to great lengths to do this (installing in a temporary venv and listing the installed package to get the name, wow), so it started to make more sense to think of this as a feature that could/should be added to pipx itself.Some thoughts on the desired behavior:
In all above cases, return a zero to the shell. Return nonzero only on an unresolvable operational error.
If this is something anyone else might want ... should it be implemented as an option to the
install
command, or a separate command, or an enhancement to the default functionality ofinstall
(rather than generating an error)? Would anyone be interested if I worked on a PR for a feature like this? Are there confounding or complicating use cases I'm not considering?Or have I missed an existing feature that would already do what I'm looking for?
The text was updated successfully, but these errors were encountered: