Support: package simpler and ship runtime assets in wheel#542
Merged
ChaoWao merged 1 commit intoApr 14, 2026
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request restructures the Python package layout by introducing simpler_setup for compilers and build orchestration, while transitioning simpler to a stable user API. It implements dynamic path resolution in simpler_setup/environment.py to support both wheel and editable installs and updates the build system to package assets. Feedback was provided regarding the validity of derived paths in wheel mode and the robustness of using importlib.resources for filesystem path resolution.
401d972 to
d0e22e1
Compare
Direct `python tests/.../test_xxx.py` runs were failing on
`from simpler.task_interface import ...` because `python/` was only on
sys.path under pytest. Make `simpler` (and its dependencies) installable
via wheel so any entry point can find it.
- pyproject.toml: include `python/simpler` in `wheel.packages`; exclude
the 4 files duplicated with `simpler_setup/` (`elf_parser`,
`kernel_compiler`, `runtime_compiler`, `toolchain`) so the
authoritative copies under `simpler_setup/` win in wheel mode while
the source-tree copies stay reachable for un-migrated callers
- pyproject.toml: enable `editable.rebuild` + `editable.verbose`, set
`build-dir = "build/{wheel_tag}"` so editable installs auto-rebuild
the nanobind module on import
- CMakeLists.txt: install `src/` and `build/lib/` under
`simpler_setup/_assets/` so wheel users get headers + pre-built
runtime binaries without a source checkout
- simpler_setup/environment.py: rewrite `PROJECT_ROOT` to auto-resolve
via `importlib.resources` — picks `_assets/` when present (wheel),
falls back to repo root (source tree / editable). Drop
`ensure_python_path` helper now that `simpler` is importable
directly
- simpler_setup/scene_test.py: remove 6 `ensure_python_path()`
callsites and the import; redundant after packaging
- examples/scripts/run_example.py: drop the `python/` sys.path insert
for the same reason
Documentation:
- docs/developer-guide.md: update Directory Structure, add Path
resolution + Python package layout sections, add Editable rebuild
notes, fix dynamic kernel compilation example, refresh Disk layout
with `build/{wheel_tag}/`
- docs/getting-started.md: switch broken `simpler.runtime_compiler` /
`runtime_builder` imports to `simpler_setup.*`
- .claude/rules/architecture.md: add Python Package Layout table,
update Build System Lookup with simpler_setup paths and PROJECT_ROOT
entry
- .claude/rules/venv-isolation.md: document `--no-build-isolation`
requirement and editable workflow
d0e22e1 to
f07a790
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.
Summary
Direct
python tests/.../test_xxx.pyruns were failing onfrom simpler.task_interface import ...becausepython/was only on sys.path under pytest. This PR makessimpler(and its dependencies) installable via wheel so any entry point can find it.Key changes
python/simplerenters the wheel; the 4 files duplicated withsimpler_setup/(elf_parser,kernel_compiler,runtime_compiler,toolchain) are excluded so the authoritative copies undersimpler_setup/win in wheel mode while source-tree copies remain reachable for un-migrated callerssrc/(headers + orchestration sources) andbuild/lib/(pre-built runtime binaries) are installed undersimpler_setup/_assets/so wheel users get everything kernel compilation needs without a source checkoutsimpler_setup/environment.py::PROJECT_ROOTauto-resolves:_assets/for wheel install, repo root for source tree / editableeditable.rebuild = trueso the nanobind module auto-rebuilds on import in editable mode (withbuild-dir = "build/{wheel_tag}"to satisfy the requirement)ensure_python_pathhelper + 6 callsites inscene_test.py, droppython/sys.path insert inrun_example.pyDocumentation
Updated
docs/developer-guide.md,docs/getting-started.md,.claude/rules/architecture.md,.claude/rules/venv-isolation.mdto reflect the new packaging model, fix broken import examples (simpler.kernel_compiler→simpler_setup.kernel_compiler), and document the editable-install workflow.Test plan
pip install --no-build-isolation -e .succeeds;simplerandsimpler_setupboth importablesimplership; 4 transitional duplicates excluded;_assets/{src,build/lib}populated (296 src + 17 lib files)PROJECT_ROOTresolves to_assets/;simpler.task_interfaceworks;simpler.kernel_compilercorrectly excludedPROJECT_ROOTresolves to repo root;editable.rebuildtriggers cmake on importpytest tests/ut/— 143 passed, 5 skippedpython tests/st/.../test_alternating_matmul_add.pyno longer hits ImportError (reaches argparse, fails only on missing-pas expected — needs hardware)