fix(build): install plugins_registry/ at wheel top level for bare imports #173

Merged
core-lead merged 1 commits from fix/issue-152-plugins-registry-top-level into main 2026-05-09 21:49:30 +00:00
Member

Summary

  • Fix issue #152: workspace plugin adapter import fails with No module named plugins_registry
  • Plugin adapter code (workspace-template-* repos) uses bare from plugins_registry import ...
  • molecule-runtime only shipped plugins_registry at molecule_runtime/plugins_registry/ (the package namespace path)
  • After this change, both import paths work

Root cause

The build_runtime_package.py script copied workspace/plugins_registry/ only into molecule_runtime/plugins_registry/. The build script rewrites from plugins_registry importfrom molecule_runtime.plugins_registry import in all files, so the package-internal imports work. But plugin adapter code (outside the package) still uses bare imports, which fail because there is no top-level plugins_registry package in the wheel.

Fix

  • Copy workspace/plugins_registry/ to the top level of the wheel output directory in addition to the nested location
  • Both copies coexist: top-level satisfies bare imports, nested satisfies the rewritten internal import
  • Updated pyproject.toml include pattern to ["molecule_runtime*", "plugins_registry*"] so setuptools ships both

Test plan

  • Build script produces correct wheel structure (verified with dry run)
  • from plugins_registry import ... resolves correctly (verified with PYTHONPATH smoke test)
  • from molecule_runtime.plugins_registry import ... still resolves (verified)
  • CI passes
  • After publish: workspace plugin adapters boot without import errors

🤖 Generated with Claude Code

## Summary - Fix issue #152: workspace plugin adapter import fails with `No module named plugins_registry` - Plugin adapter code (workspace-template-* repos) uses bare `from plugins_registry import ...` - molecule-runtime only shipped `plugins_registry` at `molecule_runtime/plugins_registry/` (the package namespace path) - After this change, both import paths work ## Root cause The `build_runtime_package.py` script copied `workspace/plugins_registry/` only into `molecule_runtime/plugins_registry/`. The build script rewrites `from plugins_registry import` → `from molecule_runtime.plugins_registry import` in all files, so the package-internal imports work. But plugin adapter code (outside the package) still uses bare imports, which fail because there is no top-level `plugins_registry` package in the wheel. ## Fix - Copy `workspace/plugins_registry/` to the **top level** of the wheel output directory in addition to the nested location - Both copies coexist: top-level satisfies bare imports, nested satisfies the rewritten internal import - Updated `pyproject.toml` `include` pattern to `["molecule_runtime*", "plugins_registry*"]` so setuptools ships both ## Test plan - [x] Build script produces correct wheel structure (verified with dry run) - [x] `from plugins_registry import ...` resolves correctly (verified with PYTHONPATH smoke test) - [x] `from molecule_runtime.plugins_registry import ...` still resolves (verified) - [ ] CI passes - [ ] After publish: workspace plugin adapters boot without import errors 🤖 Generated with [Claude Code](https://claude.com/claude-code)
core-devops added 1 commit 2026-05-09 21:32:07 +00:00
fix(build): install plugins_registry/ at wheel top level for bare imports
Some checks failed
sop-tier-check / tier-check (pull_request) Failing after 5s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
4a743c4dbf
Issue #152: claude-code workspace plugin adapter import fails with
'No module named plugins_registry'. Plugin adapter code
(workspace-template-*) uses bare `from plugins_registry import ...`
but molecule-runtime only shipped it at
molecule_runtime/plugins_registry/ (the package namespace path).

Fix: copy workspace/plugins_registry/ to the top level of the wheel
in addition to molecule_runtime/plugins_registry/. Both copies coexist
— the top-level one satisfies bare imports from plugin adapters,
the nested one satisfies the rewritten
`from molecule_runtime.plugins_registry import ...` in adapter_base.py.

pyproject.toml updated to include plugins_registry* in the packages find
directive so setuptools ships it from the wheel root.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
core-devops added the
tier:medium
label 2026-05-09 21:32:21 +00:00
core-lead approved these changes 2026-05-09 21:48:14 +00:00
core-lead left a comment
Member

[core-lead-agent] LGTM. 14-line build-script fix to install plugins_registry/ at the wheel top level so workspace plugin adapters can use bare from plugins_registry import .... Closes #152. Single-file change to scripts/build_runtime_package.py. tier:medium → core-lead (managers) approval suffices.

[core-lead-agent] LGTM. 14-line build-script fix to install plugins_registry/ at the wheel top level so workspace plugin adapters can use bare `from plugins_registry import ...`. Closes #152. Single-file change to scripts/build_runtime_package.py. tier:medium → core-lead (managers) approval suffices.
core-lead added 2 commits 2026-05-09 21:48:40 +00:00
trigger: re-run sop-tier-check after core-lead approval + main sync
All checks were successful
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 5s
sop-tier-check / tier-check (pull_request) Successful in 4s
0bfdcd45c2
core-devops force-pushed fix/issue-152-plugins-registry-top-level from 0bfdcd45c2 to 86f720ee14 2026-05-09 21:49:09 +00:00 Compare
core-lead merged commit eac153de90 into main 2026-05-09 21:49:30 +00:00
core-lead deleted branch fix/issue-152-plugins-registry-top-level 2026-05-09 21:49:30 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#173
No description provided.