Skip to content

fix(smpy): unblock the scaffolded-app quickstart + harden the file-size lint gate - #207

Merged
antosubash merged 3 commits into
mainfrom
fix/smpy-scaffold-quickstart
Jun 8, 2026
Merged

fix(smpy): unblock the scaffolded-app quickstart + harden the file-size lint gate#207
antosubash merged 3 commits into
mainfrom
fix/smpy-scaffold-quickstart

Conversation

@antosubash

@antosubash antosubash commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the scaffold/CLI quickstart papercuts that block a freshly-generated app, plus a CI gap in the file-size check. Pure backend/CLI/CI — no docs (the doc issues #196/#197/#198 were handled separately by #205; only the #196 residual ships as its own small PR).

Issues closed

Tests

New regression coverage in framework/cli/tests/ and scripts/tests/:

  • host/main.py pins the host dir on sys.path before chdir; create-module pins (and, without a version, keeps ranges); dev-api watches modules/; the Makefile has the quality-gate targets and upgrade heads; the root pyproject ships the dev tooling/config.
  • A live smoke test (test_sm_new_generated_app_passes_its_own_ruff) scaffolds a real app and runs its own ruff gate end-to-end.
  • check_file_size catches an untracked-not-ignored oversized file and passes when the only violation is gitignored.

Out of scope

git ls-files lists only tracked paths, so a new oversized file passed
make lint while untracked and failed only after being committed. Switch
the default scan to 'git ls-files --cached --others --exclude-standard'
so the working tree (minus gitignored paths) is checked, catching
violations before commit.

Fixes #204
Four interlocking quickstart bugs in `smpy new` / `create-*` scaffolds,
all touching the same shared templates, so they ship together.

#194 main.py chdir broke `from routes import`: the generated host/main.py
chdir'd to the repo root before importing the sibling `routes` module, but
uvicorn launches `main:app` with sys.path[0] == '' (the cwd, resolved
lazily) — after the chdir that points at the wrong dir and the import
fails (and the --reload subprocess re-imports the same way). Pin the host
dir on sys.path as an absolute path *before* the chdir.

#195 create-module pins were unsatisfiable: the module template ships
`simple_module_*>=1.0,<2.0` (the framework's future API line) but the
published dists are 0.0.x, so `uv add ./modules/<name>` couldn't resolve.
Add scaffolding.pin_framework_deps() + a framework_version arg on
create_module(); the `smpy create-module` command now pins to the
installed framework version. Dedupes app_project's sample-module pinning.

#201 scaffold couldn't run its own quality gates: generated Makefiles had
no test/lint/doctor targets and `migrate` used `alembic upgrade head`
(singular — errors once a second module adds a branch label). Add
test/test-py/test-js/lint/doctor targets and the backing dev tooling
(ruff, ty, pytest-asyncio, pytest-playwright) + pytest/ruff/ty config to
the workspace root (and flat host), switch migrate to `upgrade heads`, and
make the generated code lint-clean (noqa: E402 on the deliberate
post-chdir imports, drop a RET504 in migrations/env.py). A new test runs
the scaffold's own ruff gate end to end so template edits can't regress it.

#202 module edits didn't hot-reload: dev-api only watched the launch cwd
(host/). Add `--reload-dir . --reload-dir ../modules` so edits to in-repo
module packages reload too.

Fixes #194
Fixes #195
Fixes #201
Fixes #202
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 8, 2026

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: c421ced
Status: ✅  Deploy successful!
Preview URL: https://f4e576aa.simple-module-python.pages.dev
Branch Preview URL: https://fix-smpy-scaffold-quickstart.simple-module-python.pages.dev

View logs

Adding the #201/#202 regression tests pushed test_cli_new.py from 300 to 374
lines, tripping the 300-line file-size CI gate. Split the workspace/flat layout
and quality-gate tests into test_cli_new_scaffold_layout.py (by responsibility,
not by squeezing). Both files now well under the cap; all 22 tests still pass.
@antosubash
antosubash merged commit 9412cb8 into main Jun 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment