Generally, I think that griffe should somehow separate between
a) modules imported
b) modules available because the loaded object is a package
and also
c) .is_package should be True whenever the module is, in fact, a package (it doesn't do this for subpackages right now)
Current Behavior:
Anytime a package (a folder with a __init__.py) is loaded, .modules will list
a) the other modules in that folder
b) all of the other packages in that folder
b) all of the modules imported
You can traverse the package tree by following .modules but the .is_package attribute returns False for subpackages.
package1/
__init__.py
package2/
__init__.py
...other.pys
Lets say you .load('package1'), and traverse via .modules to package2, griffe wont recognize it as a package- just a module. However, its .modules will still show its ...other.pys, so in some way we know its a package, because those other modules are not imported.
I should note that a package, once imported in python, is really just a module, except named after the folder and containing the contents of __init__.py, AFAIK. The only time in python I've ever seen the fact that something is a package matter is when using import since it allows us to traverse directories.
Generally, I think that
griffeshould somehow separate betweena) modules imported
b) modules available because the loaded object is a package
and also
c)
.is_packageshould beTruewhenever the module is, in fact, a package (it doesn't do this for subpackages right now)Current Behavior:
Anytime a package (a folder with a
__init__.py) is loaded,.moduleswill lista) the other modules in that folder
b) all of the other packages in that folder
b) all of the modules imported
You can traverse the package tree by following
.modulesbut the.is_packageattribute returnsFalsefor subpackages.Lets say you
.load('package1'), and traverse via.modulestopackage2,griffewont recognize it as a package- just a module. However, its.moduleswill still show its...other.pys, so in some way we know its a package, because those other modules are not imported.I should note that a package, once imported in python, is really just a module, except named after the folder and containing the contents of
__init__.py, AFAIK. The only time in python I've ever seen the fact that something is a package matter is when usingimportsince it allows us to traverse directories.