Use stdlib importlib.metadata instead of importlib_metadata + pkg_resources fallback - #426
Open
andlo wants to merge 1 commit into
Open
Use stdlib importlib.metadata instead of importlib_metadata + pkg_resources fallback#426andlo wants to merge 1 commit into
andlo wants to merge 1 commit into
Conversation
…ort + pkg_resources fallback This project already requires Python >=3.10 (pyproject.toml), well past the Python 3.8 floor for stdlib importlib.metadata -- so the external importlib_metadata backport package, and the pkg_resources fallback for when it's missing, are both unnecessary now. Confirmed as a real, reproducible bug, not just a style cleanup: in a fresh virtualenv where importlib_metadata isn't installed (it's not declared as a dependency of this package), _iter_plugins() falls through to the pkg_resources branch, which itself raises ModuleNotFoundError on a recent setuptools -- setuptools no longer bundles pkg_resources by default in current releases, and is removing it entirely. This broke skill loading end-to-end for us (confirmed via skill-ovos-stop: ModuleNotFoundError: No module named 'pkg_resources', reproduced consistently on real hardware). Using importlib.metadata directly removes both failure modes at once, with no dependency to add. All 27 existing tests in test/unittests/test_utils.py still pass unchanged.
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughEntry-point discovery now uses Python’s standard-library ChangesEntry-point discovery
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
andlo
added a commit
to andlo/haos-ovos-addons
that referenced
this pull request
Aug 5, 2026
… -- filed OpenVoiceOS/ovos-plugin-manager#426 proposing the actual root-cause fix (stdlib importlib.metadata instead of the importlib_metadata+pkg_resources fallback). Our setuptools pin stays either way, as a safety net for any already-published release.
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.
What
Replaces the
try: from importlib_metadata import entry_points / except ImportError: import pkg_resourcesfallback in_iter_plugins()with a directfrom importlib.metadata import entry_points(stdlib).Why
This project already requires
python_requires >= 3.10(pyproject.toml), well past the Python 3.8 floor for stdlibimportlib.metadata. Both the externalimportlib_metadatabackport and thepkg_resourcesfallback are unnecessary now.Confirmed as a real, reproducible bug on real hardware, not just a style cleanup: in a fresh virtualenv where
importlib_metadataisn't installed (it's not declared as a dependency of this package),_iter_plugins()falls through to thepkg_resourcesbranch -- which itself raisesModuleNotFoundError, since recentsetuptoolsreleases no longer bundlepkg_resourcesby default (and are removing it entirely per the upstream deprecation notice). This broke skill loading end-to-end for us -- reproduced consistently viaskill-ovos-stop:ModuleNotFoundError: No module named 'pkg_resources'.Using
importlib.metadatadirectly removes both failure modes at once, with no new dependency to declare.Testing
All 27 existing tests in
test/unittests/test_utils.pypass unchanged against this change.Context
Found while building a venv-per-skill isolation layer for a Home Assistant integration project -- happy to share more reproduction detail if useful.
Summary by CodeRabbit