Search code examples
pythondjangopypi

How do I effectively make changes to a 3rd party django app?


I am working on a Django application which uses django-leaflet, but this question applies to any python library. I want to change some django-leaflet code to see if the changes would solve a problem we are having. What are my options? Do I need to create an example app in the django-leaflet repository and preform my modify-test loop there? Or do I need to upload individual re-named versions of django-leaflet to pypi?


Solution

  • You can always change the code directly in site-packages/, although that requires a certain level of attention to detail to prevent shooting yourself in the foot.

    Other than that you can check out the code and, from the directory containing the 3rd party package's setup.py, do

    pip install -e .
    

    (which is similar, but better, than python setup.py develop)

    This will install a link to the sources in site-packages/ so you can do the modify/test loop in the 3rd party package and run tests in your own package.

    The advantage being that you'll have VCS support for your changes.