pywire 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. {pywire-0.1.3 → pywire-0.1.4}/PKG-INFO +1 -1
  2. {pywire-0.1.3 → pywire-0.1.4}/pyproject.toml +1 -1
  3. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/generator.py +5 -40
  4. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/loader.py +3 -0
  5. {pywire-0.1.3 → pywire-0.1.4}/.github/CODEOWNERS +0 -0
  6. {pywire-0.1.3 → pywire-0.1.4}/.github/workflows/ci.yml +0 -0
  7. {pywire-0.1.3 → pywire-0.1.4}/.github/workflows/deploy-docs.yml +0 -0
  8. {pywire-0.1.3 → pywire-0.1.4}/.github/workflows/publish.yml +0 -0
  9. {pywire-0.1.3 → pywire-0.1.4}/.gitignore +0 -0
  10. {pywire-0.1.3 → pywire-0.1.4}/LICENSE +0 -0
  11. {pywire-0.1.3 → pywire-0.1.4}/README.md +0 -0
  12. {pywire-0.1.3 → pywire-0.1.4}/docs/.gitignore +0 -0
  13. {pywire-0.1.3 → pywire-0.1.4}/docs/.prettierignore +0 -0
  14. {pywire-0.1.3 → pywire-0.1.4}/docs/.prettierrc +0 -0
  15. {pywire-0.1.3 → pywire-0.1.4}/docs/.vscode/extensions.json +0 -0
  16. {pywire-0.1.3 → pywire-0.1.4}/docs/.vscode/launch.json +0 -0
  17. {pywire-0.1.3 → pywire-0.1.4}/docs/README.md +0 -0
  18. {pywire-0.1.3 → pywire-0.1.4}/docs/astro.config.mjs +0 -0
  19. {pywire-0.1.3 → pywire-0.1.4}/docs/eslint.config.js +0 -0
  20. {pywire-0.1.3 → pywire-0.1.4}/docs/package.json +0 -0
  21. {pywire-0.1.3 → pywire-0.1.4}/docs/pnpm-lock.yaml +0 -0
  22. {pywire-0.1.3 → pywire-0.1.4}/docs/public/favicon.svg +0 -0
  23. {pywire-0.1.3 → pywire-0.1.4}/docs/scripts/check +0 -0
  24. {pywire-0.1.3 → pywire-0.1.4}/docs/scripts/lint +0 -0
  25. {pywire-0.1.3 → pywire-0.1.4}/docs/src/assets/houston.webp +0 -0
  26. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content/docs/guides/example.md +0 -0
  27. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content/docs/guides/getting-started.md +0 -0
  28. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content/docs/guides/walkthrough.md +0 -0
  29. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content/docs/index.mdx +0 -0
  30. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content/docs/reference/api.md +0 -0
  31. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content/docs/reference/example.md +0 -0
  32. {pywire-0.1.3 → pywire-0.1.4}/docs/src/content.config.ts +0 -0
  33. {pywire-0.1.3 → pywire-0.1.4}/docs/src/styles/custom.css +0 -0
  34. {pywire-0.1.3 → pywire-0.1.4}/docs/tsconfig.json +0 -0
  35. {pywire-0.1.3 → pywire-0.1.4}/scripts/README.md +0 -0
  36. {pywire-0.1.3 → pywire-0.1.4}/scripts/build +0 -0
  37. {pywire-0.1.3 → pywire-0.1.4}/scripts/check +0 -0
  38. {pywire-0.1.3 → pywire-0.1.4}/scripts/coverage +0 -0
  39. {pywire-0.1.3 → pywire-0.1.4}/scripts/docs +0 -0
  40. {pywire-0.1.3 → pywire-0.1.4}/scripts/install +0 -0
  41. {pywire-0.1.3 → pywire-0.1.4}/scripts/lint +0 -0
  42. {pywire-0.1.3 → pywire-0.1.4}/scripts/test +0 -0
  43. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/__init__.py +0 -0
  44. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/cli/__init__.py +0 -0
  45. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/cli/generators.py +0 -0
  46. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/cli/main.py +0 -0
  47. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/cli/tui.py +0 -0
  48. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/cli/validate.py +0 -0
  49. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/.prettierignore +0 -0
  50. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/.prettierrc +0 -0
  51. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/build.mjs +0 -0
  52. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/eslint.config.js +0 -0
  53. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/package.json +0 -0
  54. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/pnpm-lock.yaml +0 -0
  55. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/app.ts +0 -0
  56. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/dom-updater.test.ts +0 -0
  57. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/dom-updater.ts +0 -0
  58. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/index.ts +0 -0
  59. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transport-manager.test.ts +0 -0
  60. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transport-manager.ts +0 -0
  61. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transports/base.ts +0 -0
  62. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transports/http.ts +0 -0
  63. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transports/index.ts +0 -0
  64. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transports/websocket.ts +0 -0
  65. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/core/transports/webtransport.ts +0 -0
  66. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/dev/dev-app.ts +0 -0
  67. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/dev/error-trace.test.ts +0 -0
  68. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/dev/error-trace.ts +0 -0
  69. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/dev/index.ts +0 -0
  70. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/dev/status-overlay.ts +0 -0
  71. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/events/handler.test.ts +0 -0
  72. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/events/handler.ts +0 -0
  73. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/pywire.core.ts +0 -0
  74. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/src/pywire.dev.ts +0 -0
  75. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/tsconfig.json +0 -0
  76. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/client/vitest.config.ts +0 -0
  77. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/__init__.py +0 -0
  78. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/ast_nodes.py +0 -0
  79. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/__init__.py +0 -0
  80. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/base.py +0 -0
  81. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/conditional.py +0 -0
  82. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/events.py +0 -0
  83. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/form.py +0 -0
  84. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/loop.py +0 -0
  85. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/attributes/reactive.py +0 -0
  86. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/build.py +0 -0
  87. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/build_artifacts.py +0 -0
  88. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/__init__.py +0 -0
  89. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/attributes/__init__.py +0 -0
  90. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/attributes/base.py +0 -0
  91. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/attributes/events.py +0 -0
  92. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/directives/__init__.py +0 -0
  93. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/directives/base.py +0 -0
  94. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/directives/path.py +0 -0
  95. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/codegen/template.py +0 -0
  96. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/__init__.py +0 -0
  97. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/base.py +0 -0
  98. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/component.py +0 -0
  99. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/context.py +0 -0
  100. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/layout.py +0 -0
  101. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/no_spa.py +0 -0
  102. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/path.py +0 -0
  103. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/directives/props.py +0 -0
  104. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/exceptions.py +0 -0
  105. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/interpolation/__init__.py +0 -0
  106. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/interpolation/base.py +0 -0
  107. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/interpolation/jinja.py +0 -0
  108. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/parser.py +0 -0
  109. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/paths.py +0 -0
  110. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/compiler/preprocessor.py +0 -0
  111. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/core/wire.py +0 -0
  112. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/py.typed +0 -0
  113. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/__init__.py +0 -0
  114. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/aioquic_server.py +0 -0
  115. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/app.py +0 -0
  116. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/compile_error_page.py +0 -0
  117. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/debug.py +0 -0
  118. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/dev_server.py +0 -0
  119. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/dev_server.py.broken +0 -0
  120. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/error_page.py +0 -0
  121. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/error_renderer.py +0 -0
  122. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/escape.py +0 -0
  123. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/files.py +0 -0
  124. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/helpers.py +0 -0
  125. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/http_transport.py +0 -0
  126. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/logging.py +0 -0
  127. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/page.py +0 -0
  128. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/pydantic_integration.py +0 -0
  129. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/router.py +0 -0
  130. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/server.py +0 -0
  131. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/style_collector.py +0 -0
  132. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/upload_manager.py +0 -0
  133. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/validation.py +0 -0
  134. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/websocket.py +0 -0
  135. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/runtime/webtransport_handler.py +0 -0
  136. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/static/pywire.core.min.js +0 -0
  137. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/static/pywire.dev.min.js +0 -0
  138. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/templates/error/404.html +0 -0
  139. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/templates/error/500.html +0 -0
  140. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/templates/error/base.html +0 -0
  141. {pywire-0.1.3 → pywire-0.1.4}/src/pywire/templates/error/compile_error.html +0 -0
  142. {pywire-0.1.3 → pywire-0.1.4}/tests/debug_router.py +0 -0
  143. {pywire-0.1.3 → pywire-0.1.4}/tests/test_app_advanced.py +0 -0
  144. {pywire-0.1.3 → pywire-0.1.4}/tests/test_app_exhaustive.py +0 -0
  145. {pywire-0.1.3 → pywire-0.1.4}/tests/test_app_mode.py +0 -0
  146. {pywire-0.1.3 → pywire-0.1.4}/tests/test_app_runtime.py +0 -0
  147. {pywire-0.1.3 → pywire-0.1.4}/tests/test_async_features.py +0 -0
  148. {pywire-0.1.3 → pywire-0.1.4}/tests/test_codegen_generator.py +0 -0
  149. {pywire-0.1.3 → pywire-0.1.4}/tests/test_codegen_template.py +0 -0
  150. {pywire-0.1.3 → pywire-0.1.4}/tests/test_codegen_template_exhaustive.py +0 -0
  151. {pywire-0.1.3 → pywire-0.1.4}/tests/test_compile_error.py +0 -0
  152. {pywire-0.1.3 → pywire-0.1.4}/tests/test_compiler_sourcemap.py +0 -0
  153. {pywire-0.1.3 → pywire-0.1.4}/tests/test_comprehensive_python_syntax.py +0 -0
  154. {pywire-0.1.3 → pywire-0.1.4}/tests/test_config.py +0 -0
  155. {pywire-0.1.3 → pywire-0.1.4}/tests/test_custom_errors.py +0 -0
  156. {pywire-0.1.3 → pywire-0.1.4}/tests/test_debug_middleware.py +0 -0
  157. {pywire-0.1.3 → pywire-0.1.4}/tests/test_debug_mock.py +0 -0
  158. {pywire-0.1.3 → pywire-0.1.4}/tests/test_error_handling_debug.py +0 -0
  159. {pywire-0.1.3 → pywire-0.1.4}/tests/test_file_routing.py +0 -0
  160. {pywire-0.1.3 → pywire-0.1.4}/tests/test_fixes.py +0 -0
  161. {pywire-0.1.3 → pywire-0.1.4}/tests/test_form_validation.py +0 -0
  162. {pywire-0.1.3 → pywire-0.1.4}/tests/test_generator_advanced.py +0 -0
  163. {pywire-0.1.3 → pywire-0.1.4}/tests/test_generator_exhaustive.py +0 -0
  164. {pywire-0.1.3 → pywire-0.1.4}/tests/test_hooks_removal.py +0 -0
  165. {pywire-0.1.3 → pywire-0.1.4}/tests/test_http_transport.py +0 -0
  166. {pywire-0.1.3 → pywire-0.1.4}/tests/test_inline_compilation.py +0 -0
  167. {pywire-0.1.3 → pywire-0.1.4}/tests/test_interactivity_codegen_complex.py +0 -0
  168. {pywire-0.1.3 → pywire-0.1.4}/tests/test_interactivity_compiler.py +0 -0
  169. {pywire-0.1.3 → pywire-0.1.4}/tests/test_jinja_interpolation.py +0 -0
  170. {pywire-0.1.3 → pywire-0.1.4}/tests/test_layouts.py +0 -0
  171. {pywire-0.1.3 → pywire-0.1.4}/tests/test_lifecycle_hooks.py +0 -0
  172. {pywire-0.1.3 → pywire-0.1.4}/tests/test_logging_stream.py +0 -0
  173. {pywire-0.1.3 → pywire-0.1.4}/tests/test_method_binding.py +0 -0
  174. {pywire-0.1.3 → pywire-0.1.4}/tests/test_middleware_error.py +0 -0
  175. {pywire-0.1.3 → pywire-0.1.4}/tests/test_mode_gating.py +0 -0
  176. {pywire-0.1.3 → pywire-0.1.4}/tests/test_naming_conventions.py +0 -0
  177. {pywire-0.1.3 → pywire-0.1.4}/tests/test_parser_advanced.py +0 -0
  178. {pywire-0.1.3 → pywire-0.1.4}/tests/test_parser_compiler.py +0 -0
  179. {pywire-0.1.3 → pywire-0.1.4}/tests/test_pjax_error.py +0 -0
  180. {pywire-0.1.3 → pywire-0.1.4}/tests/test_reactive_attributes.py +0 -0
  181. {pywire-0.1.3 → pywire-0.1.4}/tests/test_relocation_error.py +0 -0
  182. {pywire-0.1.3 → pywire-0.1.4}/tests/test_rendering.py +0 -0
  183. {pywire-0.1.3 → pywire-0.1.4}/tests/test_router_exhaustive.py +0 -0
  184. {pywire-0.1.3 → pywire-0.1.4}/tests/test_router_expansion.py +0 -0
  185. {pywire-0.1.3 → pywire-0.1.4}/tests/test_router_runtime.py +0 -0
  186. {pywire-0.1.3 → pywire-0.1.4}/tests/test_runtime_helpers.py +0 -0
  187. {pywire-0.1.3 → pywire-0.1.4}/tests/test_script_injection.py +0 -0
  188. {pywire-0.1.3 → pywire-0.1.4}/tests/test_server_validation.py +0 -0
  189. {pywire-0.1.3 → pywire-0.1.4}/tests/test_static_assets.py +0 -0
  190. {pywire-0.1.3 → pywire-0.1.4}/tests/test_strict_routing.py +0 -0
  191. {pywire-0.1.3 → pywire-0.1.4}/tests/test_style_collector.py +0 -0
  192. {pywire-0.1.3 → pywire-0.1.4}/tests/test_syntax_enforcement.py +0 -0
  193. {pywire-0.1.3 → pywire-0.1.4}/tests/test_templating_features.py +0 -0
  194. {pywire-0.1.3 → pywire-0.1.4}/tests/test_transport_advanced.py +0 -0
  195. {pywire-0.1.3 → pywire-0.1.4}/tests/test_transport_exhaustive.py +0 -0
  196. {pywire-0.1.3 → pywire-0.1.4}/tests/test_validation_exhaustive.py +0 -0
  197. {pywire-0.1.3 → pywire-0.1.4}/tests/test_websocket_advanced.py +0 -0
  198. {pywire-0.1.3 → pywire-0.1.4}/tests/test_websocket_exhaustive.py +0 -0
  199. {pywire-0.1.3 → pywire-0.1.4}/tests/test_websocket_handler.py +0 -0
  200. {pywire-0.1.3 → pywire-0.1.4}/tests/test_wire_primitive.py +0 -0
  201. {pywire-0.1.3 → pywire-0.1.4}/tox.ini +0 -0
  202. {pywire-0.1.3 → pywire-0.1.4}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pywire
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: HTML-over-the-wire Python web framework
5
5
  Author-email: Reece Holmdahl <reece@pywire.dev>
6
6
  License-File: LICENSE
@@ -7,7 +7,7 @@ name = "pywire"
7
7
  authors = [
8
8
  { name="Reece Holmdahl", email="reece@pywire.dev" },
9
9
  ]
10
- version = "0.1.3"
10
+ version = "0.1.4"
11
11
  description = "HTML-over-the-wire Python web framework"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.11"
@@ -1485,45 +1485,8 @@ class CodeGenerator:
1485
1485
 
1486
1486
  for node in python_ast.body:
1487
1487
  if isinstance(node, (ast.Import, ast.ImportFrom)):
1488
- # Skip imports - already handled
1488
+ # Skip imports - already handled at module level
1489
1489
  continue
1490
- elif isinstance(node, ast.Assign):
1491
- # Module-level assignments become class attributes
1492
- # UNLESS they target 'self' (e.g. self.x = 1), which makes no sense at class level
1493
- # and implies instance initialization.
1494
-
1495
- is_instance_assign = False
1496
- for target in node.targets:
1497
- # Check if target is Attribute(value=Name(id='self'))
1498
- if (
1499
- isinstance(target, ast.Attribute)
1500
- and isinstance(target.value, ast.Name)
1501
- and target.value.id == "self"
1502
- ):
1503
- is_instance_assign = True
1504
- break
1505
-
1506
- # Also check if value is a Call (like wire()) or mutable structure.
1507
- # These should be instance-level to avoid shared state.
1508
- is_mutable_init = isinstance(
1509
- node.value,
1510
- (
1511
- ast.Call,
1512
- ast.List,
1513
- ast.Dict,
1514
- ast.Set,
1515
- ast.ListComp,
1516
- ast.DictComp,
1517
- ast.SetComp,
1518
- ),
1519
- )
1520
-
1521
- if is_instance_assign or is_mutable_init:
1522
- top_level_statements.append(node)
1523
- else:
1524
- # Simple literals (int, str) stay class attributes
1525
- transformed.append(node)
1526
-
1527
1490
  elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
1528
1491
  # Check for decorators
1529
1492
  new_decorators = []
@@ -1544,8 +1507,10 @@ class CodeGenerator:
1544
1507
  # Classes are moved to module level, skip here
1545
1508
  continue
1546
1509
  else:
1547
- # Other statements (Expr, If, For, While, Try)
1548
- # Move to top-level init
1510
+ # ALL other statements (Assign, AnnAssign, AugAssign, Expr, If, For, While, Try, etc.)
1511
+ # are moved to __top_level_init__ for consistent instance-scope execution.
1512
+ # This ensures that dependent code (e.g., conn = ...; conn.row_factory = ...)
1513
+ # all runs in the same scope at instance creation time.
1549
1514
  top_level_statements.append(node)
1550
1515
 
1551
1516
  if top_level_statements:
@@ -80,6 +80,9 @@ class PageLoader:
80
80
  module_any.load_layout = self.load_layout
81
81
  module_any.load_component = self.load_component
82
82
 
83
+ # Inject __file__ for relative path resolution
84
+ module.__file__ = str(pywire_file)
85
+
83
86
  exec(code, module.__dict__)
84
87
 
85
88
  page_class = self._find_page_class(module, pywire_file)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes