Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix importing submodules in pythonizations #667

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

m-fila
Copy link
Contributor

@m-fila m-fila commented Sep 6, 2024

BEGINRELEASENOTES

  • Fix pythonizations trying to import local modules as pythonizations submodules

ENDRELEASENOTES

load_pythonizations function was by accident sometimes trying to import some local files of downstream projects as submodules of pythonization 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 of pythonizations found by walk_modules, but then it will try to recursively find submodules somehow including utils also among the local modules if present. I'm not sure whether this is intended or actual bug in pkgutils

Anyway I replace the walk_packages with iter_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)

Copy link
Collaborator

@tmadlener tmadlener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this. Then key4hep/EDM4hep#290 should pick it up in the CI workflows

@tmadlener tmadlener merged commit df5430c into AIDASoft:master Sep 9, 2024
18 checks passed
@m-fila m-fila deleted the pythonization_submodules branch September 9, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants