Skip to content

Resolve GH #199, #200, #203, #206 (background_tasks beat, test fixtures, dashboard docs, create-host pinning) - #209

Merged
antosubash merged 3 commits into
mainfrom
worktree-fix-issues
Jun 8, 2026
Merged

Resolve GH #199, #200, #203, #206 (background_tasks beat, test fixtures, dashboard docs, create-host pinning)#209
antosubash merged 3 commits into
mainfrom
worktree-fix-issues

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Addresses four open issues found while building real consumer apps on the framework.

#206smpy create-host ships unsatisfiable framework pins (bug)

Standalone create-host rendered the template's forward-looking ranges (simple_module_*>=1.0,<2.0, module deps >=0.1,<1.0) verbatim — nothing on PyPI satisfies them pre-1.0, so the generated host's first uv sync failed. The smpy new workspace path already rewrote these via _rewrite_pyproject; standalone create-host never did.

  • cli.py passes resolve_framework_version() into create_host; scaffolding.create_host pins every simple_module_* host dep (framework and selected bundled modules) to the lockstep version.
  • Version-pinning helpers extracted to pins.py (own responsibility; also keeps scaffolding.py under the 300-line cap), re-exported via scaffolding.__all__ so callers are unchanged.
  • Pin-or-skip rule unified in _should_pin_framework_version so create_host/create_module treat the None/"*" sentinels identically.

#200 — published simple_module_test plugin doesn't ship its headline fixtures (bug)

settings/db_state/engine/db_session/app/client/authenticated_client lived only in this repo's root conftest.py, so consumers installing the plugin hit "fixture not found" despite the README advertising them.

  • Moved them into simple_module_test/fixtures.py, registered via the pytest11 plugin. Root conftest.py slimmed — this repo now dogfoods the plugin like any consumer. authenticated_client keeps a lazy users import (same soft-import pattern as the existing eager-celery bootstrap). README/__init__ corrected.

#199 — no hook for a module to register a beat schedule (bug)

beat_schedule was a hardcoded dict; the docs implied modules could add entries and pointed at the broken on_after_configure signal.

  • A module contributes periodic work by shipping tasks.py with a module-level BEAT_SCHEDULE dict, merged in build_celery (worker-safe; runs identically in web/worker). Built-in entries stay authoritative on a name clash (now with a warning). A tasks.py that fails its own import surfaces instead of being silently dropped.
  • Docs document the convention and the on_after_configure pitfall.

#203 — no way to contribute dashboard cards (enhancement)

Resolved by design (maintainer decision): the bundled dashboard is intentionally non-extensible — consumers build their own dashboard page. Documented in docs/modules/dashboard.md.

Verification

  • Full Python suite: 1337 passed, 2 skipped (+11 new tests).
  • ruff format --check, ruff check, ty, file-size cap, hardcoded-strings, metadata, readmes — all clean.
  • Two-pass code review (high-effort fan-out + convergence pass); all actionable findings fixed, second pass clean.

#206 create-host: pin simple_module_* host deps (framework + selected
  bundled modules) to the installed lockstep version so the generated
  host's first `uv sync` resolves; the template's >=1.0,<2.0 / >=0.1,<1.0
  ranges match nothing against pre-1.0 dists. cli passes
  resolve_framework_version(); scaffolding.create_host pins (skips the '*'
  sentinel). Split version-pinning helpers into pins.py (file-size cap).

#200 testing: ship the headline app/db/client fixtures (settings, db_state,
  engine, db_session, app, client, authenticated_client) from the published
  simple_module_test plugin instead of only the framework repo's root
  conftest. Root conftest slimmed; README/__init__ corrected.
  authenticated_client keeps a lazy users import.

#199 background_tasks: modules can register Celery beat entries via a
  module-level tasks.BEAT_SCHEDULE dict, merged in build_celery (worker-safe,
  built-ins authoritative on clash). Docs document the convention and the
  on_after_configure pitfall.

#203 dashboard: documented the bundled dashboard as intentionally
  non-extensible (build your own page); resolved by design, no API added.
Address code-review findings on the #199/#206 work:
- celery_app: don't mask a broken module tasks.py — only swallow
  ModuleNotFoundError when the tasks module/package genuinely doesn't
  exist; a tasks.py whose own import fails now surfaces.
- celery_app: warn (don't silently drop) when a module beat entry name
  clashes with a built-in entry; built-in still wins.
- scaffolding: unify the pin-or-skip rule into _should_pin_framework_version
  so create_host and create_module treat the None/"*" sentinels identically
  (a "*" passed to create_module no longer risks the invalid `==*` pin).
- tests for all three.
@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: 6998136
Status: ✅  Deploy successful!
Preview URL: https://f661fd77.simple-module-python.pages.dev
Branch Preview URL: https://worktree-fix-issues.simple-module-python.pages.dev

View logs

Moving the app/db/client fixtures from the root conftest into the published
plugin (#200) made every 'fixtures live in conftest.py' reference stale.
Updated the live docs + CLAUDE.md to attribute them to the simple_module_test
plugin, and expanded the module-authoring fixtures table to list the full set
module authors now get (settings/db_session/app/client/authenticated_client),
noting authenticated_client needs the users module. Dated plans/specs left as
historical record.
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