Hacker News new | ask | show | jobs
by jasonpeacock 1214 days ago
The article talks about installing Python packages for development, but if you find yourself using `pip` to install Python tools/scripts then you should use `pipx` - it will properly sandbox those tools so they don't break (or be broken by) the system or other Pythons:

https://pypa.github.io/pipx/

2 comments

The problem is that everyone has different problems with python packaging and everyone has different idea what you "should" do.
The tool specific usecase with pipx is unique though, it's laser focused and perfect at the job of getting a python tool to users regardless of whatever wacky state their Python install is in. It's kind of separate from the issues of managing dependencies. It's a fantastic tool I wish more python documentation and users would embrace.
The core problem (as I see it) is that Linux distros tend not to have any firm distinction between "system" packages, "user" packages, and "development" packages (which are a subset of user packages). The system package manager installs everything globally, while also being considered the only approved/safe way to install packages.

Languages tend to try to get around this by providing their own package registries and build systems to use them (npm, pip, cargo, etc), and developer tools often include some sort of sandboxing to avoid interference from the system packages (venv, bazel, cargo, nix develop, etc).

For user packages a tool like Snap, home-manger, Flatpak, or AppImage seems necessary.

Python makes the problems very obvious, especially since it has so many package management systems, gets used for system packages, and gets used for user applications.

Not really.

Pipx uses the ecosystem standard of "make a venv" and it just exposes the binary entrypoint of what you installed.

It is exactly what everything says you should do, because everyone agrees. It just does it for you.

If anyone's interested in a pipx clone with excellent tab completion, I would appreciate any feedback on pipz, a function of my zsh plugin for python environment and dependency management: zpy

https://github.com/andydecleyre/zpy