fix(scaffold): unbreak fresh sm new host boot (#106-#111) - #113
Merged
Conversation
Resolves the chain of issues that prevented a freshly-scaffolded host from booting and serving its frontend: - #106 host pyproject template now uses [tool.uv] package=false instead of a hatchling build-system (host apps aren't installable libraries) - #107 declare simple_module_settings on every module that imports settings.registration (users, background_tasks, file_storage), and add it to the scaffold's host deps as defense in depth. Avoids the circular dep that hosting -> settings would create - #108 _inertia_setup falls back to <project_root>/templates when host/templates is missing, matching the layout sm new produces - #109 scaffold Makefile gen-pages now invokes python -m simple_module_hosting (no plugin discovery needed) - #110 @simple-module-py/ui exports map adds explicit subpath patterns for components, components/ui, layouts, hooks, lib, styles so Vite can resolve module-page imports - #111 SM017 skips wheel-installed modules under site-packages — its suggestion to write package.json/tsconfig.json there is impractical (files get obliterated on reinstall). Skip moved to top of the check so installed modules short-circuit before the rglob walk.
Uh oh!
There was an error while loading. Please reload this page.
7 tasks
antosubash added a commit
that referenced
this pull request
May 2, 2026
…pace (#110-#117) (#118) * fix(scaffold,ui): unbreak fresh-install module pages + scaffold workspace (#110-#117) * packages/ui: move lucide-react, sonner, radix-ui, and 11 other runtime imports out of peerDependencies into dependencies so a host that pulls in @simple-module-py/ui actually gets them installed; only React/Inertia stay as peers (singletons). Drop the catch-all "./*": "./src/*" exports entry and pin every subpath ("./components/*", "./layouts/*", etc.) to its real .tsx/.ts target with a types conditional, fixing vite resolve failures from module pages. (#114, #115, #110) * modules/{users,dashboard,permissions,feature_flags,background_tasks, file_storage}: declare lucide-react and/or sonner as dependencies — the modules import these directly, but every wheel was shipping "dependencies": {} so `sm host sync-js-deps` had nothing to install. Wire sync-js-deps into the scaffolded Makefile's `install` target so a fresh `sm new` host gets module JS deps without a manual extra step. (#116) * sm new: default to a workspace layout — scaffold modules/hello/ as a working authoring template (module.py + settings.py + endpoints/api.py), add [tool.uv.workspace] members=["modules/*"] + a workspace source for the sample, and "workspaces": ["client_app", "modules/*"] in package.json so npm + vite resolve module .tsx files naturally. New --flat flag preserves the legacy single-host layout. The module template gained a settings.py.tpl (module.py.tpl was already importing it) and pydantic-settings as a dep. (#117) #111 (SM017 pointing inside .venv/site-packages) was already fixed in #113 and is covered by test_silent_when_module_lives_in_site_packages — no code change needed. * refactor(scaffold): collapse workspace flags + reuse pypi-name helper Review feedback on #118: - _inject_py_deps had two correlated booleans (workspace_sources, drop_workspace); collapse to a single flat: bool and rename the helper to _rewrite_pyproject since it now configures the uv workspace too, not just deps. - Reuse _module_to_pypi_name from scaffolding.py instead of re-templating simple_module_{_SAMPLE_MODULE_NAME} inline. - Trim WHAT-narration comments in the host pyproject template and drop the duplicated lookup in the helper. * fix(scaffold): annotate package.json data as dict[str, Any] for ty ty narrowed the literal-dict branch to dict[str, str | bool] and rejected the data['workspaces'] = list assignment. Explicit annotation widens it.
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 freeto 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
Fixes the chain of bugs that prevented a freshly-scaffolded host from booting and serving its frontend. After this change,
sm new my-app→make install→make migrate→make devworks end-to-end.Closes#106, #107, #108, #109, #110, #111.
What changed
pyproject.toml.tplnow uses[tool.uv] package = falseinstead of a hatchling[build-system]. Host apps aren't installable libraries — there's no<name>/package dir to ship, so hatchling was failing the wheel build.simple_module_settingsas a runtime dep on every module that importssettings.registration(users,background_tasks,file_storage), and added it to the scaffold's host deps as defense in depth. Avoided declaring it onsimple_module_hostingbecausesimple_module_settingsalready depends on hosting (would create a cycle)._inertia_setupnow falls back to<project_root>/templateswhen<project_root>/host/templatesis absent, matching the layoutsm newproduces. The framework's ownhost/package keeps working unchanged.Makefile'sgen-pagestarget now invokespython -m simple_module_hosting gen-pagesdirectly, sidestepping thesm hostplugin-discovery path that wasn't reachable from a fresh scaffold.@simple-module-py/uiexports map adds explicit subpath patterns for./components/*,./components/ui/*,./layouts/*,./hooks/*,./lib/*,./styles/*(with the.tsx/.ts/ verbatim extensions). Vite can now resolve@simple-module-py/ui/components/PageShell-style imports from module-shipped pages.site-packages/— its suggestion to createpackage.json/tsconfig.jsoninside the venv is impractical (files get obliterated on reinstall). The skip is at the top of the check so installed modules short-circuit before thepages.rglob('*.tsx')walk.Test plan
uv run pytest -x -q --ignore=tests/e2e— 965 passeduv run ruff check framework/ modules/— cleanuv run ruff format --check— cleanframework/core/tests/test_module_diagnostics.pyuvx --from simple_module_cli sm new my-app --db sqlite --preset standard -y && cd my-app && make install && make migrate && make devshould boot the API and Vite without error