Answer the question
In order to leave comments, you need to log in
How to properly organize submodules in Git?
Now I am writing a personal project and made some of the modules separate repositories on Github (submodules).
The conditional project has:
project/ main.py - main script
project/module_1_path/ module_1.py - some submodule number times
project/module_2_path/ module_2.py - some submodule number two
project/logger_path/ logger.py - mine logger (also a submodule), which is used in all other modules, and all modules get access to it through
This is not very correct in terms of what if I suddenly want to use module_1 in another projectfrom logger_path import logger
, I will need to clone it, and then remember (or catch an import error) that I also need to clone the logger to the project root.
You can make a submodule logger for each module, but then, for example, in this case, I will no longer have one logger that everyone accesses, but three copies of one repository, and each module will access its own.
So the question is how to be? How can I make it so that in the next project I would simply clone module_1 into the project and he would pull the logger after himself?
Answer the question
In order to leave comments, you need to log in
Why not just install packages from the git repository via pip into the project environment with all the dependencies?
A submodule is a separate and independent entity, it does not drag anything behind it.
Of course, you can smear yourself with submodules, but very soon you will check to rake it all up :)
Also, keep in mind that with this approach. if you break backward compatibility between modules, then when you update, everything that has not received fixes will fall.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question