News for hackers. Stuff that matters.
Re:Make Your Python CLI Tools Pop with Rich by 41b696ef1113 on Friday January 21, 2022 @12:19AM (#30019476)
>but IIRC installing packages globally was pretty brittle.

The current trick is to use pipx[0]. Pipx will create an individual virtual environment for every executable tool you have, so there is no chance of conflicts.

You do `pipx install httpie` or `pipx install black` and then both utilities will be on your PATH, installed with whatever dependencies they require. I have never run into any issues with it.

Ninja edit: it also makes upgrades trivial: `pipx upgrade-all`

[0] https://pypa.github.io/pipx/

Re:Make Your Python CLI Tools Pop with Rich by MereInterest on Friday January 21, 2022 @12:31AM (#30019545)
This might be an old man yelling at clouds, but I feel like virtual environments should be used for development and testing, but not for deployment. I'm development and testing, virtual environments let you test the package against many different versions of the dependencies. Using it for deployment, though, means that after a security hotfix, the admin needs to hunt down each utility's copy of a dependency, rather than just updating the one shared copy of the dependencies.
Re:Make Your Python CLI Tools Pop with Rich by 41b696ef1113 on Friday January 21, 2022 @12:46AM (#30019653)
While everything about Python packaging is still a mess (but we now have a walrus operator, win?), I view virtual environment distribution as nothing more than a clunky static vs dynamic linking situation. Trust the system or bring your own.

I see the rise of Docker as indication that static linking won.

Re:Make Your Python CLI Tools Pop with Rich by 0x008 on Friday January 21, 2022 @01:32AM (#30019946)
But dependencies should be pinned for every application anyway to not break compatibility when sysadmin goes and updates all dependencies.

There are two sides of the coin :)

Re:Make Your Python CLI Tools Pop with Rich by renewiltord on Friday January 21, 2022 @01:39AM (#30019997)
For a language like Python, the pipx venv is similar to a Go static link. Same model of problem.