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
.pthfiles actually necessary, given the existence of--pythonand--targetoptions 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 thepippackage is onsys.pathwhen 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
--pythonoption forpipx install. For Pip it shouldn’t matter, but on principle this seems brittle since it’s looking forsite-packagesspecifically intended for a different version of Python. -
When do these
setuptoolsandwheelinstallations 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 freshsetuptoolsandwheelinto 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. ↩︎