2

I am trying to figure out how to include a modified package into a Django 2.2 project.

The package has been modified. A few skins have been added to the editor. That is, it is no longer the same package that is installed when one does pip install <package>. My understanding is that it now needs to be added to source control and probably added to the project directory, instead of being located within a virtual environment's directory.

The question is what is the way go about this situation most efficiently. Should I add the package to the project's directory or is there a way to somehow manage this through pip and requirements.txt?

MadPhysicist
  • 5,401
  • 11
  • 42
  • 107

1 Answers1

1

You can push the modified library's source to a git repository and in order to install it in your projects, you can make use of PIP's VCS Support to install it via git.

For example

python -m pip install git+https://github.com/username/repository.git

requirements.txt should be something like

package-one==1.9.4
git+git://github.com/username/repository.git
package-three==1.0.1

So you don't have to keep the modified library source in the project directory, and can be installed in any project as a usual package.

Sumithran
  • 6,217
  • 4
  • 40
  • 54
  • I see. But in this case I take upon the task of ensuring this package is up-to-date with possible developments of its original author, right? Any advice there? – MadPhysicist May 17 '21 at 13:43
  • 1
    Yeah sure you have to make sure the fork is updated timely, but there is a way you can automate this task with GitHub actions see [this thread](https://stackoverflow.com/q/23793062/6562458). – Sumithran May 17 '21 at 14:34