10 ms·
As I recall, pipx does this; it installs a separate env, but then provides entrypoints (commands) to the global environment. For example, it would install ansi
by danudey 4y ago
As I recall, pipx does this; it installs a separate env, but then provides entrypoints (commands) to the global environment.
For example, it would install ansible and the ansible dependencies to a separate environment somewhere, but still put commands for `ansible`, `ansible-playbook`, etc. into /usr/local/bin for example. When you run the ansible command, it loads ansible from the separate environment.
I haven't actually tried this myself since our environments are pretty uniform, but it could be worth looking into. It would be nice if pip itself provided this as an option (or if it became the default), but that could also become extremely complicated in terms of upgrades. I already hate having to download and build scipy, but it would be incredibly irritating to have to do it once for every tool I have that uses it. I'm sure some kind of cache could be made to work, but it's not trivial.
- andreareina 4y agoBig fan of pipx, but I don't think it would work here? Local ansible calls remote python directly and that's where the modules need to be, so a sandboxed {local,remote} ansible would be inert. There's a workaround but it's not ergonomic and I always forget what it is.