I'm trying to build a code-intelligence tool for myself on top of astroid, and I'm confused about the way that astroid decides how to name modules, and when to include __init__ files in the project. I've been creating my astroid projects like this:
where project_path is an absolute filesystem path to the root of my project.
In some cases, the module names in the resulting project are the absolute path to the file. In other cases, they're the 'dot-notation' path with my project name prepended (e.g. 'my_project.some_root_level_module'), and in still others, they're the dot-notation path without the project name (e.g. 'some_root_level_module'). I've also noticed that only some of the __init__.py files in my project get added as modules.
As far as I can tell, this has something to do with whether or not the project source is contained within the current Python path. Even then, I'm still getting inconsistent behavior. Could someone explain to me how the names are supposed to work, and when __init__ files are registered with the project?
Thanks for any help you can offer,