dh-virtualenv icon indicating copy to clipboard operation
dh-virtualenv copied to clipboard

support for --editable pip requirements?

Open dougroyal opened this issue 8 years ago • 6 comments

My requirements.txt file has requirements that point to my company's internal git repo, for example:

$ cat foo-service/requirements.txt 
-e git+ssh://[email protected]/[email protected]#egg=bar_decoder

When I build a package, the easy-install.pth file references the build directory, not the dpkg install dir.

$ cat /usr/share/python/foo-service/lib/python3.4/site-packages/easy-install.pth 
import sys; sys.__plen = len(sys.path)
/home/doug/build_dpkgs/foo-service/debian/foo-service/usr/share/python/foo-service/src/bar-decoder
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

Everything else works fine; If I update the easy-install.pth file, the service runs as expected.

Are -e or "editable" dependencies supported by dh-virtualenv?

dougroyal avatar Feb 02 '16 17:02 dougroyal

+1 . I can't say that it is because of the described issue. However editable dependencies are clearly not supported. .../bin/pip list in the package virtualenv, shows none which are editable.

dennybaa avatar Feb 03 '16 20:02 dennybaa

What is missing to support this? There are so many ways to build packages in python, so it might help to give a concrete use case and point out how and where the new feature appear.

einarf avatar Feb 10 '16 17:02 einarf

From the looks of it it seems that the shebang-rename script should peek into the .pth files too. I'm bit concerned that it might be a tad risky for other packages, especially for old 2.x style namespaces (not sure from top of my head if they have a path in the .pth files)

One could make this optional by detecting possible -e or --editable passed to pip or present in requirements.txt, but then it would be a crazy layer of implicit magic.

I think for supporting this the passing of the flag is already supported, either via the provided extra arguments for pip and via the requirements file. What's left is extending the shebang mangling to look into the .pth files (or maybe only easy-install.pth?)

nailor avatar Feb 11 '16 08:02 nailor

Is there a reason to use editable at all? If you drop -e pip will still install from git

As for the pth file problem, we've solved this in other places with virtualenv-tools. Our fork which supports pth files

asottile avatar Mar 17 '17 17:03 asottile

Remove "-e " from your requirements.txt and all will works fine. Now, in pip its supported. See point 4 https://pip.pypa.io/en/stable/user_guide/#requirements-files

lasizoillo avatar Mar 27 '18 16:03 lasizoillo

Should be resolved by mentioning it in "howtos" ⇒ add "docs" label

jhermann avatar Sep 28 '18 10:09 jhermann