python项目之间怎么引用
高洛峰
高洛峰 2017-04-17 17:42:10
0
3
451

两个python工程ProjectA和ProjectB,正常方式是将ProjectB打包成一个模块然后给ProjectA引用,但是现在ProjectB修改非常频繁无法稳定,如何直接在ProjectA中引用ProjectB呢?
环境是windows+pycharm

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
阿神

It seems to be more about project collaboration. I suggest
1) Program for interfaces, which will largely ensure the overall advancement of your project. The principle is also relatively simple, that is, Project B does not need to implement the specific implementation first, but decides with the two development teams of Project A which interfaces are stable and which are unstable. Unstable APIs should be reserved for later use. Implementation, so that even if ProjectB is updated frequently, it will not affect the coding of ProjectA. If all subsequent needs cannot be fully considered due to the capabilities of designers and architects, we should try our best to make ProjectB able to do so under the premise of brainstorming. Provide the most complete interface possible.
2) I’m not sure about your company’s internal project management standards. For example, whether you have done enough unit testing for ProjectB to ensure smooth integration with ProjectA. If not before, I suggest you test ProjectB at key nodes. To do some basic unit testing, countless painful lessons tell us that for a weakly typed language like Python, there will definitely be problems if there is not enough UT.
3) When 1&2 are solved, you can choose any way to release ProjectB, whether using rsync synchronization, docker release, or svn update. After each release, you can do an integration test to see the code quality. .
4) If the current planning of ProjectB is very poor, there is no stable API, and it often changes. If this is already an established fact, it is recommended that you encapsulate the ProjectB interface and provide a logic-oriented encapsulation, that is, between ProjectB and ProjectA Add an intermediate layer between them. ProjectA should not directly operate ProjectB, but operate the intermediate layer to ensure the code stability of A/B

PHPzhong

Package it into a module and install it directly into the project path, so you don’t need to install it again when modifying Project B

小葫芦

Install ProjectB in development mode in the environment of ProjectA, and then directly update the code of ProjectB without reinstalling it.

git clone ProjectB
python ProjectB/setup.py develop   # 开发模式安装
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template