[code-quality] Module naming conventions in astroid, and inclusion of __init__.py

David Jackson forspareparts at gmail.com
Tue May 27 22:32:06 CEST 2014


Hi, guys,

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:

AstroidManager().project_from_files([project_path])

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,


David Jackson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20140527/ddefaa34/attachment.html>


More information about the code-quality mailing list