pipx
pipx copied to clipboard
pipx requirements.txt support for installing many tools onto many machines
I have read #1031 & #1391, and am aware of pipx install-all, but I think I'm addressing a reasonable use case here that isn't covered by any of these previous issues, or pipx's current functionality
How would this feature be useful?
To be able to easily install a set list of Python programs with pipx and update them in an automated fashion.
Currently, our company tries to generate a single requirements.txt (from a requirements.in of all the Python programs we want) to cover everything we want available, and that's then installed by pip system-wide (caveats of doing so aside). The problem we've run into recently is that there's something new that we want to install that has conflicting requirements with existing packages we're holding back. Thus I thought we could use pipx to have all the commandline tools we wanted available seamlessly without having to try and produce a single unicorn requirements.txt that fits business constraints and user needs. Doing this manually on my personal machine is easy, but automating the rollout and maintenance of this company-wide would be a challenge, hence this feature suggestion.
Describe the solution you'd like
What I want to be able to to have is a requirements-pipx.txt for the system-wide commandline tools I want deployed, and then be able to run pipx install --global --force -r requirements-pipx.txt (or better yet, a remote requirements file, like pip supports) on a scheduled task on users' machines, which would install/upgrade/downgrade all the packages listed in the file.
pipx install-all can't be used for this as far as I can tell because some of the metadata in the JSON file is user/machine specific. It seems more like a tool to be used to reinstall everything from a clean slate on the same machine for the same user. Plus, due to the complexities of the format, it essentially needs you to have everything installed to be able to do pipx list --json, instead of just being able to write the list of packages you want by hand.
Describe alternatives you've considered
Currently I have a cobbled together very brittle Python script that effectively converts a requirements-pipx.txt file into a pipx install invocation and runs it using subprocess.
I can try and find time to help implement and/or test the feature if the idea is greenlit
Any questions, let me know :)
I have a similar request allow 'pipx install' to preinstall from requirements.txt file #1525
@RickyDaMa check out https://docs.astral.sh/uv/concepts/workspaces/ maybe this is useful for your situation.
I see the use case for this, but as pip does not have a public interface to parse their requirements.txt files, we'd have to re- implement it from scratch or come up with our own syntax, implement and document it. I feel like that is not a reasonable thing to do, especially if we want to reproduce what pip does, as we'd have to continuously keep the logic in sync.
IMO writing a quick bash script that takes a file with very minimum syntax (only what you need), converts it, and passes it to pipx would be the way to go here.
Maintaining said bash script would be exact same work, only distributed to every pipx user in the world.