◐ Shell
clean mode source ↗

Message 204780 - Python tracker

Running this command in the installer should now clean up pip and setuptools:

    python -m ensurepip._uninstall

If pip is not installed, it silently does nothing.

If pip is installed, but doesn't match ensurepip.version(), it throws RuntimeError.

If pip is installed and is the expected version, it removes both pip and setuptools (there's no separate version check before removing setuptools)

The tests in test_ensurepip are mocked out (to avoid any side effects on the test process), but test_venv now covers both installation and uninstallation (since it invokes a subprocess, thus avoiding the side effect problem).