Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change .egg-info directory with pip install --editable

Tags:

python

pip

Is there a way to modify the location of the .egg-info directory that is generated upon:

pip install --editable .

I'm asking because I store my source code on (locally synchronized) cloud storage, and I want to install the package in editable mode on independent computers. So, ideally, the package directory would not be polluted with anything related to a given installation of the package.

I have tried using the --src option but this did not work; I don't understand what this option is meant to do.

like image 825
Adam Avatar asked Jan 18 '19 19:01

Adam


1 Answers

You can achieve this by adding the egg_base option to setup.cfg:

[egg_info]
egg_base = relative/path/to/egg_info_folder

I have used this successfully in pip 19.3.1.

In my environment, the actual files that this altered are:

  • /anaconda/envs/my_env/lib/python3.6/site-packages/easy-install.pth
  • /anaconda/envs/my_env/lib/python3.6/site-packages/package_name.egg-link

Note, pip install raises an error if the egg_base base is not a relative path. But directly altering the files appears to work:

/anaconda/envs/my_env/lib/python3.6/site-packages/easy-install.pth:

/path/to/repository/folder

/anaconda/envs/my_env/lib/python3.6/site-packages/package_name.egg-link:

/path/to/egg_info/folder
/path/to/repository/folder/
like image 182
Chris Sewell Avatar answered Oct 25 '22 15:10

Chris Sewell