Automatically fetching latest version of a file on import

折月煮酒 提交于 2019-12-06 15:14:51

In some cases, we put .pth files in the Python site-packages directory. The .pth files name our various SVN checkout directories.

No install. No copy.

.pth files are described here.

Do you really want to do this? This means you could very easily roll code to a production app simply by committing to source control. I would consider this a nasty side-effect for someone who isn't aware of your setup.

That being said this seems like a pretty good solution - you may want to add some exception-handling around the network file calls as those are prone to failure.

The original strategy of having other developers copy mod1.py into their site-packages in order to use the module sounds like it's the real problem. Why aren't they just using the same source control are you are?

This auto-copying will make it hard to do rollbacks, especially if other developers copy your strategy. Imagine this same system used for dozens and dozens of files. And then imagine you actually do want to use a version of mod1.py that is not the latest for something.

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