Skip to content

fix: import design system components - #179

Merged
lbliii merged 1 commit into
mainfrom
codex/fix-design-system-imports
Jul 7, 2026
Merged

fix: import design system components#179
lbliii merged 1 commit into
mainfrom
codex/fix-design-system-imports

Conversation

@lbliii

@lbliii lbliii commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • import button, card, and alert definitions explicitly in the design-system page
  • teach the standard example smoke loader to run either run.py or app.py
  • add design_system to the standard smoke inventory

Root cause

Kida includes render a template in an isolated scope; they do not export definitions into the caller. The example relied on three {% include %} statements to make component names available, so importing app.py failed with UndefinedError: card before any colocated assertion could run.

Impact

The public design-system example runs again and demonstrates the supported {% from ... import ... %} component-library pattern. Its import-time render is now exercised by the normal tests/ suite, making this regression visible in CI while the broader example-gate work in #140 remains separate.

Validation

  • python -m pytest tests/test_examples.py -q — 15 passed
  • python -m pytest examples/design_system -q — 12 passed
  • python -m pytest examples -q — 147 passed, with one upstream Starlette deprecation warning
  • Ruff check and format check pass
  • git diff --check

Related to #140.

@lbliii
lbliii marked this pull request as ready for review July 7, 2026 14:33
Copilot AI review requested due to automatic review settings July 7, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the public examples/design_system example by switching it to the supported {% from ... import ... %} component-library pattern (since {% include %} does not export defs into the caller’s scope) and ensures the standard smoke suite can load examples that use either run.py or app.py.

Changes:

  • Add design_system to the curated tests/test_examples.py smoke inventory.
  • Update the smoke loader to import either run.py or (if absent) app.py.
  • Replace {% include %}-based component loading in the design-system page with explicit {% from ... import ... %} imports.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_examples.py Adds design_system to smoke coverage and updates the loader to support app.py-based examples.
examples/design_system/templates/page.html Imports button, card, and alert defs explicitly so component names are available in-page.

Comment thread tests/test_examples.py
Comment on lines +40 to 46
module_path = EXAMPLES_DIR / name / "run.py"
if not module_path.exists():
module_path = EXAMPLES_DIR / name / "app.py"
spec = importlib.util.spec_from_file_location(
f"examples.{name}.{module_path.stem}", module_path
)
mod = importlib.util.module_from_spec(spec)
@lbliii
lbliii merged commit d656ebf into main Jul 7, 2026
11 checks passed
@lbliii
lbliii deleted the codex/fix-design-system-imports branch July 7, 2026 14:39
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.

2 participants