Skip to content

[feat][Toolkit]: ship dev-sandbox/nic-monitor/posix-aio sources in the wheel - #1301

Open
harrisonyhq wants to merge 3 commits into
ModelEngine-Group:developfrom
harrisonyhq:develop
Open

[feat][Toolkit]: ship dev-sandbox/nic-monitor/posix-aio sources in the wheel#1301
harrisonyhq wants to merge 3 commits into
ModelEngine-Group:developfrom
harrisonyhq:develop

Conversation

@harrisonyhq

Copy link
Copy Markdown
Contributor

Make dev-sandbox / nic-monitor / posix-aio work after a non-editable ucm-toolkit wheel install.

Root cause: these tools locate their sources via registry.repo_root() (= registry.py's parents[2]), i.e. a repo-relative path. It is correct for editable/repo checkouts, but in a wheel install it points inside site-packages (not the repo), so all three tools break — and the sources aren't even shipped in the wheel.

Changes

  • toolkit: map toolkit/src/ onto the ucm_toolkit._native namespace (package-dir + include-package-data + MANIFEST.in) so the C++/shell sources ship as package data, without moving any files.
  • Adapters resolve sources via importlib.resources.files(...) (works for both editable and wheel installs):
    • dev-sandbox: build_dir defaults to native/build (override via UCM_TOOLKIT_DEV_SANDBOX_BUILD_DIR); pre-checks writability and points to --build-dir on read-only installs; drops update_tool_field (rewrote the read-only adapter.py).
    • posix-aio: locates the script via importlib.resources.files("ucm"); requires ucm installed; doctor reports MISSING gracefully when ucm is absent.
  • ucm: add __init__.py to ucm/store/test/ and ucm/store/test/e2e/ so posixstore_aio_test.py ships in the ucm wheel.
  • registry: drop the now-unused resolve_repo_path / update_tool_field; keep repo_root (still used by posix-aio _make_env).
  • scripts/build_toolkit.sh: one-shot wheel build.

Verification

  • Wheel stays py3-none-any (830KB); contains the full dev-sandbox CMake tree and nic-monitor scripts; fmt doc/test/.github pruned.
  • Fresh venv wheel install: doctor dev-sandbox / nic-monitor locate sources OK; doctor posix-aio locates the script OK once ucm is installed.
  • Editable regression: sources resolve to the repo paths, build_dir matches the old default — no regression.
  • pytest toolkit/tests: 92 passed.

Note: fully running posix-aio requires rebuilding/installing the ucm main package so posixstore_aio_test.py is actually in the ucm wheel.

Locate tool sources via importlib.resources instead of repo-relative paths
(registry.resolve_repo_path / repo_root), which are invalid after a
non-editable wheel install (repo_root() = parents[2] of registry.py points
into site-packages, not the repo).

toolkit packaging:
- Map toolkit/src onto the ucm_toolkit._native namespace (package-dir) so the
  dev-sandbox C++ tree and nic-monitor scripts ship as package data without
  being moved; add MANIFEST.in to graft the native trees and prune fmt
  doc/test/.github plus build artifacts.
- include-package-data = true.

dev_sandbox adapter:
- _source_dir/_build_dir via importlib.resources; build_dir defaults to the
  in-package native/build (UCM_TOOLKIT_DEV_SANDBOX_BUILD_DIR env override).
- Drop update_tool_field persistence (rewrites the read-only adapter.py on
  wheel installs); add a writable pre-check that points to --build-dir.

nic_monitor adapter: locate nic_monitor_pro.sh via importlib.resources.

posix_aio adapter: locate posixstore_aio_test.py via importlib.resources
under the installed ucm package (ucm.store.test.e2e); _make_env unchanged.

ucm: add __init__.py to store/test and store/test/e2e so
posixstore_aio_test.py ships in the ucm wheel.

registry: drop now-unused resolve_repo_path/update_tool_field; repo_root kept
for posix_aio _make_env.

Wheel stays pure-python py3-none-any; editable behavior unchanged.
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.

1 participant