Python Forum

Full Version: Editing and testing a package
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I found a Python package on Github that I want to modify and use for my own application. How can I best edit such a package. I've installed it using pip. Until now I edited the files in the ../site-packages/ folder, but I learned that this is not a good practice. I've made a fork in Github and edit this source code. I am using Spyder to test the code. But Spyder only imports packages from the Anaconda folder, not the Github folder.

I am a beginner in python, but what is the best practice to do this task?
Typical steps include:

0) Forking the repository... (already done)
1) Installing git.
1.1) Reading basic documentation about git and how to use it.
2) Cloning the repository to local folder, e.g. git clone https://github.com/user_account/repository.git.
3) Modifying the code in the local folder where the repository was cloned.
4) Committing and pushing changes to forked copy of the repository. git add .; git commit -m "A string describing what is done"; git push origin master (probably you will use another branch name (not master), e.g. dev)

===
Are you a windows user? So, you probably will need to type git.exe instead of git command.
I didn't work on Windows a long time.
1.fork the repo
2.download/clone your [forked] repo locally
3.install it in editable mode

as you will see in docs, you can combine 2 and 3 in one step. Also normally you would work in virtual environment

then you can work locally, any edits you make will affect your installation. You can push any changes you make back to origin, etc.