fix(extensions): load entry-point plugins on Python 3.9#2194
Merged
Conversation
load_plugins() used importlib.metadata.entry_points(group=...), which is a Python 3.10+ keyword. On 3.9 (a supported runtime + a CI matrix row) that raises TypeError, caught by the bare except -> load_plugins silently loaded NOTHING. Any extension package declared via the clawmetry.extensions entry point (e.g. the closed-source clawmetry-pro paid layer) therefore never registered on 3.9. Add _select_entry_points() that uses .select(group=) on 3.10+ and the dict form on 3.9. Verified: with clawmetry-pro installed, load_plugins() now discovers + runs its register_all on Python 3.9.6. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
extensions.load_plugins()calledimportlib.metadata.entry_points(group="clawmetry.extensions"). Thegroup=keyword is Python 3.10+. On 3.9 (a supported runtime and a CI matrix row) it raisesTypeError, which the surrounding bareexceptswallows — soload_plugins()silently loaded nothing on 3.9.Consequence: any package that registers via the
clawmetry.extensionsentry point (notably the closed-sourceclawmetry-propaid layer) would never load on a 3.9 install.Fix
_select_entry_points(group)uses the.select(group=...)API on 3.10+ and the dict form (entry_points().get(group, [])) on 3.9. No behaviour change on 3.10+.Verification
pytest tests/test_extensions.py→ 5 passed (incl. unknown-group, idempotency, emit error-swallowing).clawmetry-proinstalled locally on Python 3.9.6,load_plugins()now discovers and runs itsregister_all(registered eventclawmetry.pro.loaded,is_loaded() == True). It was a silent no-op before this fix.🤖 Generated with Claude Code