fix(plugin): add user/project plugin dirs to sys.path so factories import#92
Open
libinzhang1119-beep wants to merge 1 commit into
Open
fix(plugin): add user/project plugin dirs to sys.path so factories import#92libinzhang1119-beep wants to merge 1 commit into
libinzhang1119-beep wants to merge 1 commit into
Conversation
…port File-based USER/PROJECT plugins ship their factory module inside the plugin directory (~/.raven/plugins/<id>/), which nothing put on sys.path. Discovery found the manifest but _resolve_factory's bare importlib.import_module always failed - a self-contained plugin dropped into the user dir could never load. activate() now threads each DiscoveredPlugin's source and location into _activate_one, which calls _ensure_importable before resolving factories: for USER/PROJECT plugins it appends (not prepends, so installed packages keep priority) the plugin directory to sys.path, guarded for idempotency. BUNDLED (in-package) and ENTRY_POINTS (installed) are untouched. Add regression tests that write real on-disk factory packages (not pre-seeded into sys.modules) under user/project dirs and assert the backend/tool build end to end. Co-authored-by: Claude (claude-opus-4-8) <[email protected]>
2ca0bfc to
582a62a
Compare
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.
File-based USER/PROJECT plugins ship their factory module inside the plugin directory (~/.raven/plugins//), which nothing put on sys.path. Discovery found the manifest but _resolve_factory's bare importlib.import_module always failed — a self-contained plugin dropped into the user dir could never load.
activate() now threads each DiscoveredPlugin's source and location into _activate_one, which calls _ensure_importable before resolving factories: for USER/PROJECT plugins it appends (not prepends, so installed packages keep priority) the plugin directory to sys.path, guarded for idempotency. BUNDLED (in-package) and ENTRY_POINTS (installed) are untouched.
Add regression tests that write real on-disk factory packages (not pre-seeded into sys.modules) under user/project dirs and assert the backend/tool build end to end.
Summary
Type
Verification
Risk
Related Issues