fix importing submodules in pythonizations #667
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BEGINRELEASENOTES
ENDRELEASENOTES
load_pythonizations
function was by accident sometimes trying to import some local files of downstream projects as submodules ofpythonization
module (key4hep/EDM4hep#290 (comment))The culprit is the function
pkgutil.walk_modules
that tries to recursively find submodules on a given path.utils
is a legit submodule ofpythonizations
found bywalk_modules
, but then it will try to recursively find submodules somehow includingutils
also among the local modules if present. I'm not sure whether this is intended or actual bug inpkgutils
Anyway I replace the
walk_packages
withiter_modules
that doesn't have this weird recursive behaviour. The "downside" is that now the pythonizations must be put directly in pythonizations directory with no nesting (which was the case anyway)