Reputation: 2591
I am working python 2.7 some codes which needs to import module from the other Github repository, any suggestions on what's the best way to import the module? I could git clone the other Github repository to local, but what if there is a change I am not aware of so I still need to sync. Or should I pull the code from Github directly? Thanks in advance.
Upvotes: 0
Views: 1262
Reputation: 1735
You could add your dependencies as git submodules with git submodule add [remote url]
to your project. This will also freeze the HEAD
pointer of those dependencies to when you added them, so you don't have to worry if those projects get updated because you'll have developed your project against past dependency snapshots. You can update your submodules with git submodule update
in a testing branch, and if nothing breaks, you can easily merge the new changes (or fixes, if applicable).
Git submodules make it easy to say something like "Hey, my project currently works with this other project P at commit hash a1b2c3d4e5f6."
Upvotes: 1
Reputation: 320
Personally I would clone it to local and then reference the module from there. If a bug suddenly surfaces in the most recent commits from the module, it may impact your application right away. By keeping a stable version on your local, it would eliminate one more place to check during debugging of your application.
Of course, if you pull the module from GitHub directly then you'll get all the latest updates and features, but I would do that if the module is thoroughly tested before it gets committed.
This is just my two cents. Hope that helps.
Upvotes: 1