Python Forum
Editing and testing a package
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Editing and testing a package
#1
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?
Reply
#2
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.
Reply
#3
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.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020