Managing sys.path for multiple developers

99封情书 提交于 2019-12-02 04:01:41

Nobody should be doing sys.path.append! This is a workflow problem that you should address first and foremost.

In this situation it will be appropriate to package the toolbox into a distribution. The developer who just wants to use the code from toolbox, i.e. via an import statement or command line script, will execute:

pip install --user toolbox

The developer who wants to work on the toolbox code should also be using pip install. However, this developer should clone the repo, create/activate a virtual environment, and execute:

 pip install --editable .

In both situations, pip will sort out the necessary sys.path stuff for you in the correct way.

Follow the PyPA Python Packaging User Guide for the details on how to create a distribution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!