Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I like to edit python modules installed with pip. But, I do not know good way to avoid conflicts between local update and original one when upgrade a module.

For example,

$ pip install some_module
$ vim ~/.../some_module/something.py # update the file
$ pip install --upgrade some_module

It should occurs some trouble because of conflicts between local and original repository. (The assumption that original repo is on github is OK)

I guess One of alternatives is forking repository on github and pip install git+<repo_url>, but I'm not have confident.

What is good way to avoid this trouble?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
231 views
Welcome To Ask or Share your Answers For Others

1 Answer

You should not be editing the core files of a module, if you need to modify it you should be extending (subclassing) it and over-riding the functionality and adding your own functions, that way your code is separate from the repo's code and won't be over-written by an update or upgrade

You could also Use a virtual environment, a virtual environment is an isolated python installation/environment, it makes it easy to manage dependencies and different version of libraries/ version of python

this should get you started

http://docs.python-guide.org/en/latest/dev/virtualenvs/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...