Home > Enterprise >  pip install -e local git branch for development environment
pip install -e local git branch for development environment

Time:08-19

I'm trying to set up the development environment for modifying a Python library. Currently, I have a fork of the library, I cloned it from remote and installed it with

pip install -e git file:///work/projects/dev/git_project@branch#egg=git_project

However, it seems that instead of creating a symbolic link with pip install -e to the directory where I cloned my package, pip would copy the package to src/git_project in my virtual environment, making it difficult to modify it from there and push changes to my fork at the same time. Am I missing out on something or pip install -e doesn't actually make a symlink when installing from VCS?

I know that I can also do pip install -e git git:// to install from my remote, but it makes it difficult to see real-time changes I make without pushing my code to this fork all the time.

Is there a way I can clone a fork to my local development environment, pip install a specific branch from this cloned repo, and create a symlink link to the actual git_project folder so that I can modify the package there, push changes to my remote, and at the same time import the library anywhere in my environment to see real-time changes I make on my branch without committing anything yet?

Thanks for any help!

CodePudding user response:

pip install -e git URL means "clone the repository from the URL locally and install". If you already have the repository cloned locally and want to simply install from it: just install without Git:

cd /work/projects/dev/git_project
git checkout branch
pip install -e .
  • Related