Git submodule raises import error once used in python project -
i'm using git-submodule in python project.
the submodule project looks this:
-submodule_project - __init__.py - debug_util.py - parsing_util - __init__.py - parse.py - consts.py
parse.py
imports debug_util.py
. structure works fine submodule independent project.
my project built this:
-project - __init__.py - file1.py - some_dir - __init__.py - main.py
so once use submodule git submodule in project, parse.py
raises importerror
. happens once line imports debug_util.py
ran. clarify: main.py
imports parse.py
, imports debug_util.py
can explain me i'm doing wrong, , available solutions fix this?
here's .gitmodules
file:
[submodule "submodule_project"] path = submodule_project url = ../submodule_project.git
thanks in advance of you!
git submodules annoying work (at least last time played around them). i'd recommend against using submodules , using python's own dependency management. submodule_project
have own unique name , packaged in releases myparser-1.2.1
, , main project depend on package setup.py
.
problems git submodules (from git documentation):
- when clone [a project submodules], default directories contain submodules, none of files within them yet
- you must run 2 commands:
git submodule init
initialize local configuration file, ,git submodule update
fetch data project , check out appropriate commit listed in superproject - if create new branch, add submodule there, , switch branch without submodule, still have submodule directory untracked directory
- removing directory isn’t difficult, can bit confusing have in there. if remove , switch branch has submodule, need run
submodule update --init
repopulate it. - it’s quite if you’re using submodules, you’re doing because want work on code in submodule @ same time you’re working on code in main project (or across several submodules). otherwise instead using simpler dependency management system (such maven or rubygems).
problems git submodules (my own observations):
- you find submodules in weird states:
- you wanted peg submodule @ specific git commit, it's drifted somehow , top level project says there changes involving submodule.
- somehow file keep changing inside submodule directory , git complains unstaged changes in either top level or submodule.
- you wanted submodule track
master
, it's not working correctly , you've got merge commits aren't upstream.
- it's annoying enough
update
,init
1 level deep submodules, if 1 of submodules uses submodules? - a lot of third-party tools don't work submodules. i've found lot of third-party tools (like ides or web interfaces git) don't treat core parts of git (dealing staging area, merges, rebases, squashing, writing formatted commit messages, etc), they're bad @ features experienced git users ever use.
you don't mention how , set submodule top level project. might more helpful if pasted .gitmodules
file top level project.
Comments
Post a Comment