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?
Share
You can’t get just a subdirectory with git-submodule (see this question).
Bundling is also bad practice (it makes updating the library code in the case of a library bug more difficult, and results in useless duplication).
tweepyis on PyPI, so the best way would not be bundling it, but to require it in yoursetup.pyor list it in yourrequirements.txt(depends on whether you’re packaging it for PyPI or just building need to have an easy way to install your projects dependencies). You can specify what versions of the library are permissible when doing so, so tweepy can’t change out from under your feet.If you’re planning on making changes to
tweepy, the polite thing would be to submit those changes to the project, rather than making the changes within your project (or perhaps maintaining your own fork on GitHub iftweepywon’t accept the changes). Note thatpiphas ways to install git versions of a package if you need a version that’s not available in PyPI.