Hello, this is my first post here, so I’m not sure if it is the right communication channel to get feedback. I noticed that the function
pkgutil.walk_packages documentation says:
ModuleInfofor all modules recursively on path , or, if path is
None, all accessible modules.
Emphasis o the
modules recursively mine. The thing is that this only works recursively if the correct prefix value is provided, which is not super clear from the docs:
prefix is a string to output on the front of every module name on output.
>>> import pkgutil >>> len(list(pkgutil.walk_packages(['/usr/lib64/python3.10/xml/']))) 4 >>> len(list(pkgutil.walk_packages(['/usr/lib64/python3.10/xml/'], ''))) 4 >>> len(list(pkgutil.walk_packages(['/usr/lib64/python3.10/xml/'], 'xml.'))) 21
So I’d like to fix that, I’m not sure what is the best approach here, changing the function’s behavior (which would be a backwards incompatible change), or updating the docs to clarify this.