[Python-Dev] Deprecate PEP 370 Per user site-packages directory? (original) (raw)

Christian Heimes christian at python.org
Sat Jan 13 15:06:19 EST 2018


On 2018-01-13 19:57, Antoine Pitrou wrote:

On Sat, 13 Jan 2018 19🔞41 +0100 Christian Heimes <christian at python.org> wrote:

On 2018-01-13 19:04, Random832 wrote:

On Sat, Jan 13, 2018, at 12:06, Christian Heimes wrote:

Hi,

PEP 370 [1] was my first PEP that got accepted. I created it exactly one decade and two days ago for Python 2.6 and 3.0. Back then we didn't have virtual environment support in Python. Ian Bicking had just started to create the virtualenv project a couple of months earlier. Fast forward 10 years... Nowadays Python has venv in the standard library. The user-specific site-packages directory is no longer that useful. I would even say it's causing more trouble than it's worth. For example it's common for system script to use "#!/usr/bin/python3" shebang without -s or -I option. I propose to deprecate the feature and remove it in Python 4.0. Where would pip install --user put packages, and how would one run scripts that require those packages? Right now these things Just Work; I've never had to learn how to use virtual environments. I see two option: 1) "pip install --user" is no longer supported. You have to learn how to use virtual envs. It's really easy: "python3 -m venv path; path/bin/pip install package". 2) "pip install --user" automatically creates or uses a custom virtual (~/.pip/virtualenv-$VERSION/) and links entry points to ~/.local/bin. Option 2 doesn't work, since the installed package then isn't known to the system Python.

I see that as a benefit. User installed packages will no longer be able to break system-wide programs.

These days a lot of packages are using setuptools' entry points to create console scripts. Entry point have no option to create a console script with -s or -I flag. On my system, only 40 out of 360 scripts in /usr/bin have -s or -I.



More information about the Python-Dev mailing list