-
-
Notifications
You must be signed in to change notification settings - Fork 641
Description
What's the problem this feature will solve?
I'd like to be able to remove pip-tools and the other protected packages when running pip-sync --python-executable 'path/to/other/env.
The protection makes sense when pip-sync is running in the Python environment being modified, but doesn't seem necessary when manipulating a separate target environment.
Describe the solution you'd like
pip-sync --python-executable 'path/to/other/env should allow removing pip-tools and the other protected packages from the target environment. I'd be ok with having to pass an extra option to say "no, seriously, I mean it, remove everything that isn't listed in the requirements files", but would prefer it if that wasn't necessary.
This came up due to the fact that pip-compile doesn't currently allow resolving for an environment other than the one running pip-compile (adding a --python-executable option to pip-compile is a much harder problem, but would technically eliminate my use case for this hopefully simpler proposal).
To work around this, I'd like to be able to temporarily install pip-tools, and then remove it later with pip-sync.
Alternative Solutions
Rather than running pip-sync directly, instead run python -Ic "import piptools.scripts.sync, piptools.sync; piptools.sync.PACKAGES_TO_IGNORE.clear(); piptools.scripts.sync.cli()" (with the same CLI arguments as would be passed to a direct invocation of pip-sync)
Edit: just noting #2117 as a trap to watch out for when using --python-executable with standalone Python environments.