I’ve been experimenting with Pipx the last couple of weeks trying to figure out ways to unleash its full power. I’ve noticed that a shared venv is created that contains pip
, setuptools
and wheel
. Then the per-project venvs have .pth
files that include the shared venv’s setup, and are created --without-pip
.
So far, so good - now I don’t repeat copies of Pip across my disk just so that Pip can know where to install things. But the details of the architecture have me scratching my head a bit:
-
Are the
.pth
files actually necessary, given the existence of--python
and--target
options for Pip? Pipx presumably always knows where Pip is located, and presumably will be running it in a separate process, and presumably can figure out which executable to use it with and what flags to pass. So I don’t understand why it’s important, or even helpful, to ensure that thepip
package is onsys.path
when the application runs.I’m especially concerned here that the shared environment might not have the same Python version as a per-project one, since there’s also a
--python
option forpipx install
. For Pip it shouldn’t matter, but on principle this seems brittle since it’s looking forsite-packages
specifically intended for a different version of Python. -
When do these
setuptools
andwheel
installations actually get used? I thought that Pip defaults to isolated builds now, so that if Pipx tries to install from an sdist, Pip would be forced to install a freshsetuptools
andwheel
into an isolated environment first before installing the built wheel into the real virtual(?) environment. -
Supposing I’m right that they’re specifically there in case I explicitly do something like
pipx install pycowsay --pip-args "\"--no-build-isolation\""
[1]. What if I instead install something that uses a different backend? I don’t see a supported way to add other backends (or other packages) to the shared environment. -
Is there anything else particularly clever or subtle about this setup that I might want to know about?
I previously found in testing - while trying to avoid hitting the Internet for a simple install - that this weird quoting is necessary; one pair is stripped by the shell and the other is needed to make it a Pip arg instead of a Pipx arg. ↩︎