I want to modify some functionality in a python library available on github, therefore I have forked the repo on github and downloaded a copy to modify it. What I have been doing is pushing my modifications to my forked repo on github and then installing the library to my computer via pip install -e
as described in this answer. This has been working perfectly fine to modify the library and then execute a script that runs it.
The problem comes when I have enough modifications I want to use VSCode's debug function to debug the code locally before pushing them. When running in debug mode, of course, any intermediate library imports of the original library (and my code has many of them) call the original name of the library (lets say XXX) with import XXX
. This import goes to the pip installed version of XXX library in my computer and therefore doesn't use the version with local modification I have created.
This is of course impossible to debug locally, because my version of the library isn't even being used in most of the code, the imports are just calling the original package XXX which I have pip installed on my computer, so no breakpoints or other functions can be used.
The workaround I have done is renaming the folder of the modified local version (the one I have edited) to another name "XXX_debug" and changed all of the imports in the local copy to import XXX_debug
and from XXX_debug.import ...
. This is working fine and I can use all debug capabilities.
This seems like kind of an overkill and makes things much more difficult in my pipeline, changing it from:
- Fork- Download local copy - modify - push to my fork - install with
pip install -e
to, in order to debug with vscode:
- Fork- Download local copy - modify - change folder name and import names - debug - change back the names-push to my fork - install with
pip install -e
¿Is there any better way to do this debugging or any other better way to perform this whole library modification operation?