1

I have a Python project stored in GitHub that is going to use tweepy, a Twitter Python library stored in GitHub too. In the INSTALL file says that I can use git to bundle it in my project but I have no idea on how to do this. I thought to use git submodule but this will fetch all the project, not only the sources that is what I need. How could I do it? Is there a best way to work with external libraries in a project?

4

1 回答 1

1

您不能仅使用 git-submodule 获得子目录(请参阅此问题)。

捆绑也是不好的做法(在库错误的情况下更新库代码变得更加困难,并导致无用的重复)。tweepyPyPI 上,所以最好的方法不是捆绑它,而是在你的中要求它setup.py或在你的中列出它requirements.txt(取决于你是为 PyPI 打包它还是只是构建需要有一种简单的方法来安装你的项目依赖项)。这样做时,您可以指定允许的库版本,这样 tweepy 就不会在您的脚下改变。

如果您打算对 进行更改tweepy,礼貌的做法是将这些更改提交给项目,而不是在您的项目中进行更改(或者如果tweepy不接受更改,则可能在 GitHub 上维护自己的分支)。请注意,pip如果您需要 PyPI 中不可用的版本,则可以安装包的 git 版本。

于 2012-11-02T00:21:59.890 回答