Skip to content

fix(scaffold): unbreak fresh sm new host boot (#106-#111) - #113

Merged
antosubash merged 1 commit into
mainfrom
feature/bold-burnell-ceaf48
May 2, 2026
Merged

antosubash merged 1 commit into
mainfrom
feature/bold-burnell-ceaf48

Conversation

@antosubash

Copy link
Copy Markdown
Owner

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 dev works end-to-end.

Closes #106, #107, #108, #109, #110, #111.

What changed

Test plan

  • uv run pytest -x -q --ignore=tests/e2e — 965 passed
  • uv run ruff check framework/ modules/ — clean
  • uv run ruff format --check — clean
  • New regression test for SM017 site-packages skip in framework/core/tests/test_module_diagnostics.py
  • Manual smoke: uvx --from simple_module_cli sm new my-app --db sqlite --preset standard -y && cd my-app && make install && make migrate && make dev should boot the API and Vite without error

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.
@antosubash
antosubash merged commit 7bd73f6 into main May 2, 2026
11 checks passed
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.
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.

sm new scaffold emits hatchling build-system but no package dir — uv sync fails to build wheel

1 participant