How is "egg=" used in "pip install -e"?

Viewed 4390

Trying to test editable installs out and I'm not sure how to interpret the results.

I intentionally made a typo in the egg= portion but it was still able to locate the egg without any help from me:

root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git      
Could not detect requirement name for 'git+https://gitlab.com/jame/clientapp.git', please specify one with #egg=your_package_name

root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git#egg=
Could not detect requirement name for 'git+https://gitlab.com/jame/clientapp.git#egg=', please specify one with #egg=your_package_name

root@6be8ee41b6c9:/# pip3 install -e git+https://gitlab.com/jame/clientapp.git#egg=e
Obtaining e from git+https://gitlab.com/jame/clientapp.git#egg=e
  Cloning https://gitlab.com/jame/clientapp.git to /src/e
  Running setup.py (path:/src/e/setup.py) egg_info for package e produced metadata for project name clientapp. Fix your #egg=e fragments.
Installing collected packages: clientapp
  Found existing installation: ClientApp 0.7
    Can't uninstall 'ClientApp'. No files were found to uninstall.
  Running setup.py develop for clientapp
Successfully installed clientapp

root@6be8ee41b6c9:/# pip3 freeze
asn1crypto==0.24.0
-e git+https://gitlab.com/jame/clientapp.git@5158712c426ce74613215e61cab8c21c7064105c#egg=ClientApp
cryptography==2.6.1
entrypoints==0.3
keyring==17.1.1
keyrings.alt==3.1.1
pycrypto==2.6.1
PyGObject==3.30.4
pyxdg==0.25
SecretStorage==2.3.1
six==1.12.0

So if I could mess the egg name up so bad, why is it considered an error to either leave it blank or set to something empty

2 Answers

Hard to answer, maybe raise this as an issue on pip's bug tracker and get an accurate answer from the developers themselves.


My guess, the egg name matters if the project is a dependency of another project. For example in a case where one wants to install A from PyPI and Z from git, but Z is a dependency of A.

pip install 'A' 'git+https://example.local/Z.git#egg=Z'

egg= is the name that's used when uninstalling unpackaged libraries that's installed from a VCS repository, and the name that's used by the dependency resolver when searching for dependant packages.

If you don't care about those two use cases, they can essentially be set to anything.

it found the egg via setup.py

It didn't find the egg via setup.py, pip found the setup.py and set the egg name for the setup.py install to whatever you specified. When you're installing from a VCS, there is no package, so there's no egg name configured, egg= configures the installation as if it has been installed with a package with that egg name.

Related