I added output.write(' '.join((sys.executable, sys.prefix, str(sys.argv) + "\n"))) to my setup.py shim and ran pip install -e . ; pip install -e . --user ; pip install -e . --prefix=/usr/local/ and got this.
~/opt/anaconda3/bin/python ~/opt/anaconda3
['-c', 'develop', '--no-deps']
~/opt/anaconda3/bin/python ~/opt/anaconda3
['-c', 'develop', '--no-deps', '--user', '--prefix=']
~/opt/anaconda3/bin/python ~/opt/anaconda3
['-c', 'develop', '--no-deps', '--prefix=/usr/local/']
~/opt/pypy3/bin/python ~/opt/pypy3
['~/prog/enscons/setup.py', 'develop', '--no-deps']
~/opt/pypy3/bin/python ~/opt/pypy3
['~/prog/enscons/setup.py', 'develop', '--no-deps', '--prefix', '/usr/local/']
~/opt/pypy3.6-v7.3.1-osx64/bin/pypy3 ~/opt/pypy3.6-v7.3.1-osx6
['~/prog/enscons/setup.py', 'develop', '--no-deps', '--user', '--prefix=']
(I replaced my home directory with ~/)
The pypy virtualenv doesn’t support --user installs. I don’t know how to get --home passed in there. For me --user is only what VScode does to unsuccessfully add pytest or rope to my environment so it is not useful.
There’s pip’s implementation https://github.com/pypa/pip/blob/master/src/pip/_internal/operations/install/editable_legacy.py
enscons does develop by asking distutils where the purelib directory is and putting a file there.
>>> enscons.paths.get_install_paths('enscons')
{'purelib': '~/opt/py3env/lib/python3.7/site-packages', ... }
Since this hook would exist to provisionally get something working my preference would be to underengineer it, and have develop() take no arguments.
--no-deps is always implied since an installer is involved.
Second choice. It could take the directory in PYTHONPATH that I’m supposed to touch to link my package in.
Third choice. Pass the existing arguments prefix : str, user : bool, minus “home” if we don’t even know what it does. This would be good for setuptools compatibility. enscons would raise an Unsupported exception if those were passed.
The hook could be called link instead of develop; personally all I’m looking for is that python -m mymodule works afterwards when installing for development in a virtualenv.
If we do this then the relatively tiny number of non-setuptools packages that don’t work at all with pip install -e . start to work, in the hopefully most-common case.
In distutils Distribution:
# Ignore install directory options if we have a venv
if sys.prefix != sys.base_prefix:
ignore_options = [
'install-base', 'install-platbase', 'install-lib',
'install-platlib', 'install-purelib', 'install-headers',
'install-scripts', 'install-data', 'prefix', 'exec-prefix',
'home', 'user', 'root']
Distutils paths for beaglevote. Presumably these change when you pass user, home, or root.
--root may be so that you can build and install your package to an independent root, and then package those files with RPM.
>>> enscons.paths.get_install_paths('beaglevote'))
{'data': '/Users/daniel/opt/py3env',
'headers': '/Users/daniel/opt/py3env/include/python3.7m/beaglevote',
'platlib': '/Users/daniel/opt/py3env/lib/python3.7/site-packages',
'purelib': '/Users/daniel/opt/py3env/lib/python3.7/site-packages',
'scripts': '/Users/daniel/opt/py3env/bin'}