Import existing pip or github package for editing

Hi! I’m not working with python and django for too long. I literally spent hours on google and did not find my answer.

How do I import an existing django app for editing it in my IDE? Using pip I’m of course able to install packets to my venv folder and edit them there. The project structure then looks like that:

mysite/
    mysite/
        ...
    manage.py
venv
    Lib
        site-packages
            ...
            ==> APP INSTALLED VIA PIP INSTALL/
            ...
...

But is there any way to import an existing python app / package into the upper mysite folder?

mysite/
    mysite/
        ...
    manage.py
    ==> IMPORTED_APP/
        ....

In my PyCharm I tried to just move the app into the mysite directory with drag and drop but other parts of my project dont discover the app there. Any ideas?

In general you don’t want to do it that way.

Depending upon the project or package, you would likely want to clone the git repo to a location outside your project, make your changes in the code, and then install your modified package into your virtual environment.

(And, again depending upon the nature of the changes, you might also want to submit fixes or updates as a pull request back to the original author.)

This is not an absolute - there’s no requirement to do it this way, but it tends to be the most reliable and sustainable method of updating a third-party package.

Hi Ken, thank your for replying. Feel free to tell me if I’m wrong but that sounds not really convenient to me. Do I miss something here? Or is there a way to edit a package from an outside folder as convenient in my IDE as is it would be in my mysite directory?

I don’t use PyCharm so I don’t have any immediate suggestions for you in that area.

I know that Visual Studio Code has the facility to import a directory into your workspace. I would be a little surprised if PyCharm doesn’t provide something similar.

Thanks for your help, Ken!