add option to sandbox package and its dependencies (like pipsi)
See original GitHub issueWhat’s the problem this feature will solve?
When installing packages that have console entry_points
and should be globally accessible (such as black
), the only way to do this is to have all packages share the same dependencies.
The problems with this are
1.) packages may have conflicting dependencies 2.) even if there are no conflicts, installing packages globally mixes user installed packages with eachother and with system installed packages. This makes it difficult to know which packages rely on which; pip freeze gets very large. 3.) Isolating packages requires virtual envs which has a somewhat high learning curve, and also requires activation/deactivation, and remembering the name of each virtual env.
Describe the solution you’d like
Add a new flag to pip install
such that the installation works like pipsi
.
pipsi creates a virtual environment for each top-level package, and installs dependencies to the site-packages
within the package’s virtual environment.
pipsi installs each package into ~/.local/venvs/PKGNAME and then symlinks all new scripts into ~/.local/bin
Compared to pip install --user each PKGNAME is installed into its own virtualenv, so you don’t have to worry about different
PKGNAME
s having conflicting dependencies.
Ideas for flag names. Only one of these would be chosen.
pip install PKGNAME --isolate
pip install PKGNAME --shield
pip install PKGNAME --auto-venv
pip install PKGNAME --into-venv
pip install PKGNAME --venv
pip install PKGNAME --virtual
Alternative Solutions
Additional context
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (7 by maintainers)
@cs01 Thanks for the clarification - I’d assumed you meant virtualenv style rather than
--target
, so now that I understand what you were after, I see your point better.I think what you’re suggesting could probably be done with a relatively small wrapper script round pip. That script could run pip (via
subprocess
), then change the necessary environment variables and run the entry point (again viasubprocess
). You could make such a thing as specific or generic as you felt necessary.In fact, I think the
rwt
(“run with this”) package on PyPI may be of interest to you. As I understand it, it does something very like this.I still think it’s something we’d rather not make “official” in pip - there are too many odd edge cases that would potentially confuse users, that we’d have to support. Making the step with something like this from “works for me” to “capable of handling the needs of a big user base” is always a lot more work than it seems at first!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.