Skip to content

Conversation

@shenxiangzhuang
Copy link
Contributor

@shenxiangzhuang shenxiangzhuang commented Jun 11, 2025

@wu-sheng wu-sheng requested review from Copilot and kezhenxu94 June 11, 2025 08:28
@wu-sheng wu-sheng added this to the 1.3.0 milestone Jun 11, 2025
@wu-sheng wu-sheng added the bug Something isn't working label Jun 11, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the plugin installation process to support Python 3.12 by replacing the deprecated module loading approach with a method that uses module specs and explicitly executes the module code.

  • Replaces importer.find_module().load_module() with importer.find_spec(), module_from_spec(), and spec.loader.exec_module().
  • Adjusts the module loading mechanism to align with Python 3.12 changes.

plugin = importer.find_module(modname).load_module(modname)
else:
plugin = importlib.util.module_from_spec(importer.find_spec(modname))
spec = importer.find_spec(modname)
Copy link

Copilot AI Jun 11, 2025

Choose a reason for hiding this comment

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

Consider adding a check to ensure 'spec' is not None before invoking 'spec.loader.exec_module(plugin)' to prevent a potential AttributeError if the module spec is not found.

Suggested change
spec = importer.find_spec(modname)
spec = importer.find_spec(modname)
if spec is None:
logger.warning("Module spec for plugin %s could not be found, skipping installation.", modname)
continue

Copilot uses AI. Check for mistakes.
@shenxiangzhuang shenxiangzhuang changed the title fix(plugin): add exec_module to execute to module code fix(plugin): add exec_module to execute the module code Jun 11, 2025
@shenxiangzhuang
Copy link
Contributor Author

And, shall we release the 1.2.post0 version after this PR is merged?

@kezhenxu94 kezhenxu94 merged commit 99434d4 into apache:master Jun 11, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Can not install all the plugins with python >= 3.12

3 participants