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 version check for entrypoint plugins with unequal project/package names #2594

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

SnoopJ
Copy link
Contributor

@SnoopJ SnoopJ commented Feb 24, 2024

Description

Fixes #2593.

This changeset swallows all exceptions when trying to determine the version of an EntryPointPlugin, as there are more failure cases than what catching ValueError specifically covers, and allowing those exceptions to propagate breaks plugin reloading.

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make lint and make test)
    • 1388 passed, 8 xfailed, 1 warning in 45.44s
  • I have tested the functionality of the things this change touches

sopel/plugins/handlers.py Outdated Show resolved Hide resolved
sopel/plugins/handlers.py Fixed Show fixed Hide fixed
@dgw
Copy link
Member

dgw commented Feb 24, 2024

I dug into the original issue just a bit (literally, this time) and found that we probably could differentiate the EntryPointPlugin type from its parent class PyModulePlugin a bit more.

This PR works as a quick fix for the exact issue you ran into, but I do think the real solution should be actually handling entry points correctly (i.e. not just as "spicy modules" like the current impl).

For checking the version in particular, an EntryPoint object has a dist attribute, which itself has a name that is most likely what would be expected by the importlib.metadata.version() call whose failure in this mismatched-name case spawned #2593.

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.

Entrypoint plugins with non-equal 'project' and 'package' names cannot be reloaded
2 participants