pipx
pipx copied to clipboard
Add PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE environment variable to disable automatic shared library upgrades
Summary
Fixes #1650
This PR implements the feature requested in #1650 by adding a new environment
variable PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE that allows users to disable
automatic upgrades of shared libraries (pip, setuptools, wheel).
Motivation
Users who need to maintain compatibility with older Python versions (e.g., Python 3.8)
can encounter errors when pip automatically upgrades to versions that no longer support
their Python version. This environment variable provides a way to disable the automatic
upgrade behavior while still allowing manual upgrades via pipx upgrade-shared.
Changes Made
- Added
PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADEconstant tosrc/pipx/constants.py - Modified
src/pipx/venv.pyto check the environment variable before auto-upgrading - Added documentation in
docs/examples.mdexplaining the new feature - Added test in
tests/test_shared_libs.pyto verify the behavior
Usage
# Linux/MacOS
export PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE=1
pipx install <package> # Will NOT auto-upgrade shared libraries
# Windows (PowerShell)
$env:PIPX_DISABLE_SHARED_LIBS_AUTO_UPGRADE=1
pipx install <package> # Will NOT auto-upgrade shared libraries
@Maintainers Pls Review and Approve for Tests