pyjs 0.0.2__tar.gz → 0.4.0__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 (237) hide show
  1. pyjs-0.4.0/PKG-INFO +573 -0
  2. pyjs-0.4.0/README.md +530 -0
  3. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/__init__.py +2 -2
  4. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/cli.py +152 -46
  5. pyjs-0.4.0/pyjs/decorators.py +408 -0
  6. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/builder.py +52 -7
  7. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/cli.py +7 -7
  8. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/config.py +6 -0
  9. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/style.css +301 -6
  10. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/ui.py +37 -27
  11. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/javascript.py +67 -28
  12. pyjs-0.4.0/pyjs/lib/__init__.py +1 -0
  13. pyjs-0.4.0/pyjs/lib/pydantic/__init__.py +1 -0
  14. pyjs-0.4.0/pyjs/lib/pydantic/v2.py +217 -0
  15. pyjs-0.4.0/pyjs/nativescript/__init__.py +513 -0
  16. pyjs-0.4.0/pyjs/nativescript/collectionview.py +104 -0
  17. pyjs-0.4.0/pyjs/nativescript/haptics.py +30 -0
  18. pyjs-0.4.0/pyjs/nativescript/keyboard.py +52 -0
  19. pyjs-0.4.0/pyjs/nativescript/masonry.py +784 -0
  20. pyjs-0.4.0/pyjs/nativescript/masonry_reorder.py +484 -0
  21. pyjs-0.4.0/pyjs/nativescript/reorderable.py +361 -0
  22. pyjs-0.4.0/pyjs/nativescript/simulator.py +1023 -0
  23. pyjs-0.4.0/pyjs/nativescript/transport.py +40 -0
  24. pyjs-0.4.0/pyjs/python.py +3551 -0
  25. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/__init__.py +1 -1
  26. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app/README.md.template +9 -3
  27. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app/__PYJS_SOURCE_ROOT__/__PYJS_PACKAGE__/__PYJS_PACKAGE__.py.template +1 -1
  28. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app/__PYJS_SOURCE_ROOT__/__PYJS_PACKAGE__/__main__.py.template +1 -1
  29. pyjs-0.4.0/pyjs/server/__init__.py +1096 -0
  30. pyjs-0.4.0/pyjs/server/application.py +30 -0
  31. pyjs-0.4.0/pyjs/server/atomic.py +72 -0
  32. pyjs-0.4.0/pyjs/server/build.py +25 -0
  33. pyjs-0.4.0/pyjs/server/dev.py +1768 -0
  34. pyjs-0.4.0/pyjs/server/django/__init__.py +38 -0
  35. pyjs-0.4.0/pyjs/server/django/api.py +272 -0
  36. pyjs-0.4.0/pyjs/server/django/application.py +360 -0
  37. pyjs-0.4.0/pyjs/server/django/dispatch.py +30 -0
  38. pyjs-0.4.0/pyjs/server/django/errors.py +49 -0
  39. pyjs-0.4.0/pyjs/server/django/jsonapi.py +445 -0
  40. pyjs-0.4.0/pyjs/server/django/live.py +496 -0
  41. pyjs-0.4.0/pyjs/server/django/model.py +175 -0
  42. pyjs-0.4.0/pyjs/server/django/queryset.py +336 -0
  43. pyjs-0.4.0/pyjs/server/django/relationship.py +36 -0
  44. pyjs-0.4.0/pyjs/server/django/transport.py +20 -0
  45. pyjs-0.4.0/pyjs/server/errors.py +133 -0
  46. pyjs-0.4.0/pyjs/server/jsonapi.py +297 -0
  47. pyjs-0.4.0/pyjs/server/live.py +218 -0
  48. pyjs-0.4.0/pyjs/server/pagination.py +24 -0
  49. pyjs-0.4.0/pyjs/server/protocol.py +7 -0
  50. pyjs-0.4.0/pyjs/server/rendering.py +46 -0
  51. pyjs-0.4.0/pyjs/server/transport.py +71 -0
  52. pyjs-0.4.0/pyjs/server/watch.py +664 -0
  53. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/skills/pyjs/SKILL.md +84 -13
  54. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/state.py +0 -1
  55. pyjs-0.4.0/pyjs/stdlib/__init__.py +1 -0
  56. pyjs-0.4.0/pyjs/stdlib/dataclasses.py +168 -0
  57. pyjs-0.4.0/pyjs/stdlib/math.py +92 -0
  58. pyjs-0.4.0/pyjs/stdlib/typing.py +10 -0
  59. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/android.py +141 -1
  60. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/assertion_rewriter.py +55 -8
  61. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/builder.py +20 -5
  62. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/app.py +49 -31
  63. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/assertions.py +2 -2
  64. pyjs-0.4.0/pyjs/testing/client/pytest.py +78 -0
  65. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/runtime.py +30 -10
  66. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/sidebar.py +6 -4
  67. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/state.py +14 -11
  68. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/viewer.py +10 -10
  69. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/daemon.py +209 -125
  70. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/helpers.py +52 -26
  71. pyjs-0.4.0/pyjs/testing/interaction/__init__.py +1 -0
  72. pyjs-0.4.0/pyjs/testing/interaction/gesture.py +185 -0
  73. pyjs-0.4.0/pyjs/testing/interaction/masonry.py +702 -0
  74. pyjs-0.4.0/pyjs/testing/interaction/reorder.py +493 -0
  75. pyjs-0.4.0/pyjs/testing/interaction/scenario.py +82 -0
  76. pyjs-0.4.0/pyjs/testing/interaction/trace.py +671 -0
  77. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/pytest_plugin.py +57 -28
  78. pyjs-0.4.0/pyjs/testing/web.py +230 -0
  79. pyjs-0.4.0/pyjs/testing/webgpu.py +66 -0
  80. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/browser.py +181 -37
  81. pyjs-0.4.0/pyjs/tooling/download.py +22 -0
  82. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/nativescript.py +64 -5
  83. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/node.py +94 -22
  84. pyjs-0.4.0/pyjs/transpiler/__init__.py +61 -0
  85. pyjs-0.4.0/pyjs/transpiler/analyzer.py +8221 -0
  86. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/transpiler/diagnostics.py +149 -10
  87. pyjs-0.4.0/pyjs/transpiler/libraries.py +182 -0
  88. pyjs-0.4.0/pyjs/transpiler/objects.py +2772 -0
  89. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/transpiler/source.py +107 -7
  90. pyjs-0.4.0/pyjs/transpiler/sourcemap.py +429 -0
  91. pyjs-0.4.0/pyjs/transpiler/transpiler.py +2430 -0
  92. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/transpiler/utils.py +75 -11
  93. pyjs-0.4.0/pyjs/ui/__init__.py +31 -0
  94. pyjs-0.4.0/pyjs/ui/interaction.py +114 -0
  95. pyjs-0.4.0/pyjs/ui/reorderable.py +314 -0
  96. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/clipboard.py +13 -13
  97. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/console.py +1 -1
  98. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/crypto.py +51 -47
  99. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/dom.py +340 -185
  100. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/domx.py +113 -34
  101. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/dragdrop.py +6 -6
  102. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/encoding.py +7 -7
  103. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/events.py +87 -102
  104. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/files.py +15 -13
  105. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/geometry.py +10 -10
  106. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/html.py +245 -264
  107. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/indexeddb.py +136 -72
  108. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/navigation.py +22 -9
  109. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/network.py +21 -20
  110. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/serviceworker.py +65 -73
  111. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ssr.py +10 -8
  112. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/storage.py +5 -5
  113. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/streams.py +29 -29
  114. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/svg.py +72 -72
  115. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/timers.py +7 -7
  116. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/__init__.py +9 -0
  117. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/accordion.py +7 -6
  118. pyjs-0.4.0/pyjs/web/ui/attachment.py +129 -0
  119. pyjs-0.4.0/pyjs/web/ui/bubble.py +77 -0
  120. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/calendar.py +4 -2
  121. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/carousel.py +23 -9
  122. pyjs-0.4.0/pyjs/web/ui/chart.py +300 -0
  123. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/combobox.py +5 -2
  124. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/command.py +29 -11
  125. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/context_menu.py +1 -1
  126. pyjs-0.4.0/pyjs/web/ui/date.py +55 -0
  127. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/dialog.py +9 -6
  128. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/dropdown_menu.py +78 -42
  129. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/hover_card.py +4 -4
  130. pyjs-0.4.0/pyjs/web/ui/infinite_scroll.py +154 -0
  131. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/input_otp.py +7 -5
  132. pyjs-0.4.0/pyjs/web/ui/marker.py +45 -0
  133. pyjs-0.4.0/pyjs/web/ui/message.py +71 -0
  134. pyjs-0.4.0/pyjs/web/ui/message_scroller.py +128 -0
  135. pyjs-0.4.0/pyjs/web/ui/model.py +966 -0
  136. pyjs-0.4.0/pyjs/web/ui/pagination.py +172 -0
  137. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/popover.py +5 -6
  138. pyjs-0.4.0/pyjs/web/ui/questionnaire.py +457 -0
  139. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/radio_group.py +6 -5
  140. pyjs-0.4.0/pyjs/web/ui/reorderable.py +219 -0
  141. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/resizable.py +58 -26
  142. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/select.py +8 -5
  143. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/sidebar.py +4 -2
  144. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/slider.py +1 -1
  145. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/sonner.py +3 -1
  146. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/tabs.py +9 -6
  147. pyjs-0.4.0/pyjs/web/ui/theme.py +142 -0
  148. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/toggle.py +4 -3
  149. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/tooltip.py +1 -3
  150. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/url.py +3 -3
  151. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/webgpu.py +138 -218
  152. pyjs-0.4.0/pyjs.egg-info/PKG-INFO +573 -0
  153. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs.egg-info/SOURCES.txt +58 -2
  154. pyjs-0.4.0/pyjs.egg-info/requires.txt +18 -0
  155. {pyjs-0.0.2 → pyjs-0.4.0}/pyproject.toml +15 -5
  156. pyjs-0.0.2/PKG-INFO +0 -426
  157. pyjs-0.0.2/README.md +0 -391
  158. pyjs-0.0.2/pyjs/decorators.py +0 -245
  159. pyjs-0.0.2/pyjs/nativescript/__init__.py +0 -77
  160. pyjs-0.0.2/pyjs/python.py +0 -185
  161. pyjs-0.0.2/pyjs/server.py +0 -577
  162. pyjs-0.0.2/pyjs/testing/web.py +0 -89
  163. pyjs-0.0.2/pyjs/testing/webgpu.py +0 -27
  164. pyjs-0.0.2/pyjs/transpiler/__init__.py +0 -33
  165. pyjs-0.0.2/pyjs/transpiler/_builtins.py +0 -899
  166. pyjs-0.0.2/pyjs/transpiler/analyzer.py +0 -2034
  167. pyjs-0.0.2/pyjs/transpiler/objects.py +0 -1289
  168. pyjs-0.0.2/pyjs/transpiler/transpiler.py +0 -908
  169. pyjs-0.0.2/pyjs/web/ui/attachment.py +0 -80
  170. pyjs-0.0.2/pyjs/web/ui/bubble.py +0 -38
  171. pyjs-0.0.2/pyjs/web/ui/chart.py +0 -56
  172. pyjs-0.0.2/pyjs/web/ui/marker.py +0 -29
  173. pyjs-0.0.2/pyjs/web/ui/message.py +0 -57
  174. pyjs-0.0.2/pyjs/web/ui/message_scroller.py +0 -45
  175. pyjs-0.0.2/pyjs/web/ui/pagination.py +0 -63
  176. pyjs-0.0.2/pyjs.egg-info/PKG-INFO +0 -426
  177. pyjs-0.0.2/pyjs.egg-info/requires.txt +0 -8
  178. {pyjs-0.0.2 → pyjs-0.4.0}/LICENSE +0 -0
  179. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/__main__.py +0 -0
  180. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/__init__.py +0 -0
  181. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/favicon.svg +0 -0
  182. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/markdown.py +0 -0
  183. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/models.py +0 -0
  184. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/docs/navigation.py +0 -0
  185. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app/__PYJS_SOURCE_ROOT__/__PYJS_PACKAGE__/__init__.py.template +0 -0
  186. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app/tests/test_app.py.template +0 -0
  187. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app/tests/test_browser_app.py.template +0 -0
  188. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/scaffolding/templates/app_test.py.template +0 -0
  189. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/__init__.py +0 -0
  190. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/artifacts.py +0 -0
  191. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/capture.py +0 -0
  192. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/client/__init__.py +0 -0
  193. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/testing/protocol.py +0 -0
  194. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/__init__.py +0 -0
  195. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/android.py +0 -0
  196. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/command.py +0 -0
  197. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/tooling/perf.py +0 -0
  198. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/__init__.py +0 -0
  199. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/alert.py +0 -0
  200. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/alert_dialog.py +0 -0
  201. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/aspect_ratio.py +0 -0
  202. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/avatar.py +0 -0
  203. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/badge.py +0 -0
  204. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/breadcrumb.py +0 -0
  205. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/button.py +0 -0
  206. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/card.py +0 -0
  207. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/checkbox.py +0 -0
  208. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/collapsible.py +0 -0
  209. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/date_picker.py +0 -0
  210. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/direction.py +0 -0
  211. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/drawer.py +0 -0
  212. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/empty.py +0 -0
  213. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/field.py +0 -0
  214. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/floating.py +0 -0
  215. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/input.py +0 -0
  216. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/input_group.py +0 -0
  217. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/item.py +0 -0
  218. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/kbd.py +0 -0
  219. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/label.py +0 -0
  220. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/menubar.py +0 -0
  221. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/native_select.py +0 -0
  222. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/navigation_menu.py +0 -0
  223. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/progress.py +0 -0
  224. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/scroll_area.py +0 -0
  225. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/separator.py +0 -0
  226. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/sheet.py +0 -0
  227. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/skeleton.py +0 -0
  228. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/spinner.py +0 -0
  229. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/switch.py +0 -0
  230. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/table.py +0 -0
  231. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/text.py +0 -0
  232. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/textarea.py +0 -0
  233. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs/web/ui/typography.py +0 -0
  234. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs.egg-info/dependency_links.txt +0 -0
  235. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs.egg-info/entry_points.txt +0 -0
  236. {pyjs-0.0.2 → pyjs-0.4.0}/pyjs.egg-info/top_level.txt +0 -0
  237. {pyjs-0.0.2 → pyjs-0.4.0}/setup.cfg +0 -0
pyjs-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,573 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyjs
3
+ Version: 0.4.0
4
+ Summary: Python to JavaScript transpiler.
5
+ Author-email: Lex Berezhny <lex@damoti.com>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Homepage, https://github.com/pyjs/pyjs
8
+ Project-URL: Release notes, https://github.com/pyjs/pyjs/releases
9
+ Project-URL: Source, https://github.com/pyjs/pyjs
10
+ Project-URL: Tracker, https://github.com/pyjs/pyjs/issues
11
+ Project-URL: Discord, https://discord.gg/YktKpQPG7
12
+ Project-URL: X, https://x.com/pyjsdev
13
+ Classifier: Development Status :: 2 - Pre-Alpha
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Internet :: WWW/HTTP
22
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.14
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: markdown>=3.8
29
+ Requires-Dist: pillow
30
+ Requires-Dist: pydantic<3,>=2
31
+ Requires-Dist: pyyaml>=6.0
32
+ Requires-Dist: pytest
33
+ Requires-Dist: websockets
34
+ Provides-Extra: examples
35
+ Requires-Dist: pyjs-examples==0.4.0; extra == "examples"
36
+ Provides-Extra: extras
37
+ Requires-Dist: pyjs-extras==0.4.0; extra == "extras"
38
+ Provides-Extra: stripe
39
+ Requires-Dist: pyjs-extras[stripe]==0.4.0; extra == "stripe"
40
+ Provides-Extra: django
41
+ Requires-Dist: django<6.2,>=6.0; extra == "django"
42
+ Dynamic: license-file
43
+
44
+ <p align="center">
45
+ <img src="branding/pyjs-logo.svg" alt="PyJS" width="170">
46
+ </p>
47
+
48
+ # PyJS: Python to JavaScript
49
+
50
+ [![CI][ci-badge]][ci] [![PyPI][pypi-badge]][pypi]
51
+ [![Python][python-badge]][pypi] [![License][license-badge]][license]
52
+
53
+ **Write typed Python for servers, browsers, and Android—without shipping a
54
+ Python runtime to JavaScript targets.**
55
+
56
+ PyJS statically analyzes reachable Python and emits readable, tree-shaken
57
+ JavaScript. The same component can render real HTML on the server, hydrate as a
58
+ native custom element in the browser, and share application logic with a
59
+ NativeScript Android app.
60
+
61
+ PyJS is early-release software: complete applications and tests work today,
62
+ while APIs can still change between releases.
63
+
64
+ ## See it work in 30 seconds
65
+
66
+ ```bash
67
+ python -m pip install "pyjs[examples]"
68
+ python -m pyjs_examples.calculator
69
+ ```
70
+
71
+ Open the clickable local URL printed by the server. The Calculator is one
72
+ Python application targeting the Web, an installable PWA, and Android. Try the
73
+ [source](examples/calculator/calculator.py), then inspect its browser and
74
+ Android tests beside it.
75
+
76
+ PyJS keeps the generated result recognizable. Given:
77
+
78
+ ```python
79
+ from pyjs import js
80
+
81
+
82
+ @js
83
+ def total(prices: list[int]) -> int:
84
+ return sum(prices)
85
+
86
+
87
+ print(total([12, 30]))
88
+ ```
89
+
90
+ `pyjs --src -c '...'` emits:
91
+
92
+ ```javascript
93
+ export function total(prices) {
94
+ return (prices).reduce((total,value)=>total+value,0);
95
+ }
96
+
97
+ export function main() {
98
+ console.log(total([12, 30]));
99
+ }
100
+ ```
101
+
102
+ There is no bundled Python interpreter, virtual DOM, or JavaScript project to
103
+ maintain.
104
+
105
+ ## Create your first project
106
+
107
+ Install PyJS and create a project:
108
+
109
+ ```bash
110
+ python -m pip install pyjs
111
+ pyjs create hello_pyjs
112
+ cd hello_pyjs
113
+ python -m pip install -e ".[test]"
114
+ python -m hello_pyjs
115
+ ```
116
+
117
+ Open <http://127.0.0.1:8000/>. The generated project has no Node.js
118
+ configuration or JavaScript source: it contains a custom element, server entry
119
+ point, Python tests, and a browser test.
120
+
121
+ Run its test suite on either target:
122
+
123
+ ```bash
124
+ ruff check .
125
+ python -m pytest -q
126
+ python -m pytest -q --pyjs-target=web --pyjs-browser=managed
127
+ ```
128
+
129
+ To develop PyJS itself from a source checkout, see
130
+ [CONTRIBUTING.md](CONTRIBUTING.md).
131
+
132
+ ## What makes PyJS different
133
+
134
+ - **Python stays visible.** Generated JavaScript is readable and maps back to
135
+ the original Python in browser DevTools.
136
+ - **HTML is the handoff.** Components render on the server, retain small typed
137
+ state in the DOM, and hydrate the elements already on screen.
138
+ - **The browser is the framework.** Custom elements, attributes, events, and
139
+ Web APIs remain direct platform primitives rather than a virtual DOM.
140
+ - **Types remove runtime weight.** Static analysis specializes Python semantics
141
+ and tree-shakes code from each entry point.
142
+ - **Escape hatches stay open.** Typed browser APIs and raw transports remain
143
+ available beneath the UI and full-stack conveniences.
144
+
145
+ Coding agents can run `pyjs skill` for version-matched guidance and
146
+ `pyjs template` to discover complete executable examples. The
147
+ [installable PyJS skill](pyjs/skills/pyjs/SKILL.md) is included in the package
148
+ and public repository.
149
+
150
+ ## Start from an example
151
+
152
+ The separately installed examples progress from a one-file counter to composed
153
+ full-stack applications:
154
+
155
+ | Example | Purpose | Principal coverage |
156
+ | --- | --- | --- |
157
+ | [Counter](examples/counter.py) | Smallest app | DOM, events, tests |
158
+ | [Calculator](examples/calculator/) | Universal app | Web, PWA, Android, SSR |
159
+ | [Components](examples/components/) | UI reference | Widgets, forms, routing |
160
+ | [Notes](examples/notes/) | Personal app | Android, drag/drop, restore |
161
+ | [Chat](examples/chat/) | Real-time starter | WebSockets, multi-window |
162
+ | [Store](examples/store/) | Business app | Django, JSON:API, SSE, theming |
163
+ | [Space Invaders](examples/space_invaders/) | GPU game | WebGPU, render tests |
164
+
165
+ Inspect or copy any of them:
166
+
167
+ ```bash
168
+ python -m pip install "pyjs[examples]"
169
+ python -m pyjs_examples.calculator
170
+ pyjs template
171
+ pyjs template pyjs_examples.calculator
172
+ pyjs template pyjs_examples.calculator --src
173
+ pyjs create my_calculator --template pyjs_examples.calculator
174
+ pyjs create counter_demo --template pyjs_examples.counter
175
+ pyjs create my_counter --single-file --template pyjs_examples.counter
176
+ pyjs create components_demo --template pyjs_examples.components
177
+ ```
178
+
179
+ The template catalog contains examples that can be copied safely out of their
180
+ installed package. Store is a comprehensive runnable application instead of a
181
+ scaffold because its Django package, fixture data, and optional server
182
+ dependencies belong together. Run it directly with:
183
+
184
+ ```bash
185
+ python -m pip install "pyjs-examples[store]"
186
+ python -m pyjs_examples.store
187
+ ```
188
+
189
+ `pyjs create NAME` creates a project in `NAME/`, with application code in
190
+ `NAME/NAME/NAME.py` and tests in `NAME/tests/`. Pass a destination as the
191
+ second positional argument to populate another directory, such as
192
+ `pyjs create routine .`. Add `--src-layout` to put the package under `src/`.
193
+ After installation, `python -m NAME` starts either package layout through its
194
+ ordinary Python entry point. `pyjs serve` is also available as a convenience
195
+ and uses the application recorded in `pyproject.toml`.
196
+
197
+ `--single-file` explicitly requests one standalone Python file and requires a
198
+ file template when combined with `--template`. The `pyjs-examples`
199
+ distribution registers both file and directory templates and contains the
200
+ source copied by `pyjs create`; templates are not embedded in the scaffolding
201
+ implementation.
202
+
203
+ ## Run or inspect Python as JavaScript
204
+
205
+ For Node-compatible code, PyJS can compile and run a file, module, or command
206
+ string directly with its managed Node runtime:
207
+
208
+ ```bash
209
+ pyjs app.py
210
+ pyjs -m package.module
211
+ pyjs -c 'print(6 * 7)'
212
+ pyjs -v -c 'print(6 * 7)' # generated JavaScript followed by Node output
213
+ pyjs --src app.py # generated source only
214
+ pyjs --src-all app.py # entry source and tree-shaken dependencies
215
+ pyjs --perf -c 'print(sum(range(10)))'
216
+ ```
217
+
218
+ Use `--json` for structured results or `--perf` to compare Python and generated
219
+ JavaScript timing. DOM, WebGPU, and other browser APIs still run through an
220
+ application or browser test.
221
+
222
+ ## Build an entry point
223
+
224
+ The application server builds and serves browser assets automatically. To
225
+ write the generated JavaScript, CSS, and HTML explicitly:
226
+
227
+ ```bash
228
+ pyjs build hello_pyjs.hello_pyjs:main
229
+ ```
230
+
231
+ Use `--only-js` when only the browser bundle is needed.
232
+
233
+ ## Application model
234
+
235
+ An application entry point returns a server-rendered DOM tree. Classes
236
+ decorated with `@js` are available to the browser compiler, and reachable
237
+ methods are included in the generated bundle. `CustomElement` subclasses
238
+ render on the server and hydrate as browser-native custom elements. `ref()`
239
+ reconnects Python attributes to existing server-rendered nodes rather than
240
+ recreating them.
241
+
242
+ Module values cross the same explicit compilation boundary through a `JS`
243
+ annotation. Combine it with `Final` for constants, such as
244
+ `heartbeat_interval: Final[JS] = 5_000`; unmarked module values remain
245
+ server-only and cannot be included by an accidental browser-side reference.
246
+
247
+ Values that must survive rendering and hydration can live on the custom
248
+ element as DOM attributes. The `state()` descriptor and `@effect(...)` provide
249
+ a small typed reactive layer for updating the DOM imperatively. Server-only
250
+ handlers and browser methods can coexist in the same module.
251
+
252
+ ## Feature overview
253
+
254
+ ### Tree shaking
255
+
256
+ PyJS starts at the selected entry point and includes reachable browser code.
257
+ In this example, `sleep()` and `run()` are reachable; `eat()` and `bark()` are
258
+ omitted:
259
+
260
+ ```python
261
+ from pyjs import js
262
+
263
+
264
+ @js
265
+ class Animal:
266
+ def sleep(self):
267
+ pass
268
+
269
+ def eat(self):
270
+ pass
271
+
272
+
273
+ @js
274
+ class Dog(Animal):
275
+ def run(self):
276
+ pass
277
+
278
+ def bark(self):
279
+ pass
280
+
281
+
282
+ def main():
283
+ dog = Dog()
284
+ dog.sleep()
285
+ dog.run()
286
+ ```
287
+
288
+ Ordinary event handlers and called methods do not need `include=True`. That
289
+ option remains an escape hatch for unusual methods invoked dynamically by
290
+ JavaScript.
291
+
292
+ ### Type inference and checking
293
+
294
+ The analyzer infers types from literals, constructors, calls, and control flow.
295
+ Empty collections and public boundaries generally need annotations because
296
+ their element or return type cannot be recovered from a value:
297
+
298
+ ```python
299
+ from pyjs import js
300
+
301
+
302
+ @js
303
+ class Animal:
304
+ def __init__(self, name: str):
305
+ self.name = name
306
+
307
+ def get_name(self) -> str:
308
+ return self.name
309
+
310
+
311
+ def main():
312
+ values = {"one": 1, "two": 2}
313
+ animal = Animal("Hazel")
314
+ print(values["one"])
315
+ print(animal.get_name())
316
+ ```
317
+
318
+ Type errors are reported during analysis instead of being deferred to generated
319
+ JavaScript. Diagnostics are improving and do not yet cover every invalid
320
+ program equally well.
321
+
322
+ ### Type narrowing
323
+
324
+ Union types narrow through `isinstance()`, branches, assertions, and null
325
+ checks:
326
+
327
+ ```python
328
+ from pyjs import js
329
+
330
+
331
+ @js
332
+ def length(items: dict[str, int] | list[int] | str) -> int:
333
+ if isinstance(items, dict):
334
+ return len(items)
335
+ if isinstance(items, list):
336
+ return len(items)
337
+ assert isinstance(items, str)
338
+ return len(items)
339
+
340
+
341
+ def main():
342
+ length(["one"])
343
+ length({"one": 1, "two": 2})
344
+ length("four")
345
+ ```
346
+
347
+ `is None` and `is not None` compile to nullish JavaScript comparisons, covering
348
+ both JavaScript `null` and `undefined`, while identity comparisons between
349
+ ordinary objects retain identity semantics.
350
+
351
+ ### Operator overloading
352
+
353
+ Built-in operators use their normal JavaScript equivalents for compatible
354
+ primitive values and dispatch to Python special methods for user-defined
355
+ classes:
356
+
357
+ ```python
358
+ from pyjs import js
359
+
360
+
361
+ @js
362
+ class ListAdder:
363
+ def __init__(self):
364
+ self.values: list[str] = []
365
+
366
+ def __add__(self, other: str):
367
+ self.values.append(other)
368
+ return self
369
+
370
+ def __str__(self) -> str:
371
+ return "|".join(self.values)
372
+
373
+
374
+ def main():
375
+ values = ListAdder()
376
+ values += "a"
377
+ values += "b"
378
+ print(values)
379
+ ```
380
+
381
+ ### Generic types
382
+
383
+ The analyzer preserves concrete element and key/value types for built-in
384
+ collections such as `list[T]`, `dict[K, V]`, and `tuple[...]`. User-defined
385
+ generic specialization exists in the analyzer but remains experimental and is
386
+ not yet a stable application-facing feature.
387
+
388
+ Typed tuples and lists can be unpacked into local names. Tuple and literal-list
389
+ arity is checked during compilation; dynamic lists retain Python's runtime
390
+ arity errors. Nested, starred, and chained unpacking targets are not yet
391
+ supported.
392
+
393
+ ### Async code and exceptions
394
+
395
+ Async functions and `await` lower to JavaScript promises. Typed browser APIs
396
+ such as `fetch()`, WebSockets, and WebGPU use the same syntax as asynchronous
397
+ Python code. Basic raising and exception handling are supported, but exception
398
+ semantics are not yet a complete match for CPython.
399
+
400
+ ### Metaprogramming and compiler extensions
401
+
402
+ Module and class bodies execute in Python before analysis, so ordinary Python
403
+ metaprogramming can construct the definitions that PyJS later analyzes. The
404
+ `@js` decorator also supports client replacements and inline call generation
405
+ for typed browser API bindings. Compilation extensions can rewrite function
406
+ ASTs and inject imports before analysis; the browser-testing integration uses
407
+ this mechanism for assertion diagnostics.
408
+
409
+ These are advanced integration tools. Application code should normally use
410
+ typed Python and the APIs already provided by `pyjs.web.dom`,
411
+ `pyjs.web.domx`, and `pyjs.web.ui`.
412
+
413
+ ## Web UI and state
414
+
415
+ `pyjs.web.ui` contains reusable custom-element components inspired by shadcn/ui
416
+ and adapted for normal Python imports, subclassing, and imperative DOM
417
+ composition. The catalog includes forms, dialogs, menus, popovers, tabs,
418
+ accordions, data display, navigation, charts, and layout primitives.
419
+
420
+ ```python
421
+ from pyjs.web.ui.button import Button
422
+ from pyjs.web.ui.card import (
423
+ Card,
424
+ CardContent,
425
+ CardFooter,
426
+ CardHeader,
427
+ CardTitle,
428
+ )
429
+
430
+ profile = Card(
431
+ CardHeader(CardTitle("Profile")),
432
+ CardContent("Update your public details."),
433
+ CardFooter(Button("Save changes")),
434
+ )
435
+ ```
436
+
437
+ Reactive state is backed by custom-element attributes:
438
+
439
+ ```python
440
+ from pyjs import effect, js, state
441
+ from pyjs.web.domx import CustomElement, ref, tag
442
+
443
+
444
+ @js
445
+ class Counter(CustomElement):
446
+ count = state(0)
447
+
448
+ def __init__(self):
449
+ super().__init__()
450
+ self.value = ref(tag("output"))
451
+ tag(self, self.value)
452
+
453
+ @effect(count)
454
+ def render_count(self):
455
+ self.value.textContent = str(self.count)
456
+ ```
457
+
458
+ Effects run during server rendering. Hydration reuses that rendered result
459
+ rather than repeating the initial effect in the browser.
460
+
461
+ ## Testing
462
+
463
+ PyJS registers a pytest plugin that can run portable tests in Python or compile
464
+ them for isolated browser iframes:
465
+
466
+ ```bash
467
+ python -m pytest -q
468
+ python -m pytest -q --pyjs-target=web
469
+ ```
470
+
471
+ Use `pytest.mark.pyjs_web` for tests that should be compiled and run in the
472
+ browser. Unmarked tests run only as ordinary Python tests;
473
+ `pytest.mark.pyjs_python` can make that intent explicit. A filename such as
474
+ `test_browser_dialog.py` is only an organizational convention and has no
475
+ implicit behavior.
476
+
477
+ Browser tests retain console output and errors. Tests that render meaningful
478
+ UI retain their iframe preview, and render assertions can compare screenshots
479
+ against checked-in PNG baselines.
480
+
481
+ ## Commands
482
+
483
+ | Command | Purpose |
484
+ | --- | --- |
485
+ | `pyjs --version` | Show the installed version |
486
+ | `pyjs FILE.py`, `pyjs -m MODULE`, `pyjs -c CODE` | Run with managed Node |
487
+ | `pyjs --src INPUT` | Print generated JavaScript without running it |
488
+ | `pyjs --src-all INPUT` | Include all tree-shaken dependency sources |
489
+ | `pyjs --perf INPUT` | Compare Python and generated-JavaScript performance |
490
+ | `pyjs create NAME [DESTINATION]` | Create a starter project |
491
+ | `pyjs serve [TARGET]` | Serve a configured project, module, or Python file |
492
+ | `pyjs template` | List templates registered by installed packages |
493
+ | `pyjs template NAME` | Print the complete materialized template source |
494
+ | `pyjs template NAME --src` | Print the transpiled entry-module JavaScript |
495
+ | `pyjs build MODULE[:ENTRY]` | Write generated JavaScript, CSS, and HTML |
496
+ | `pyjs docs build` | Build a static documentation site |
497
+ | `pyjs docs serve` | Build and serve documentation locally |
498
+ | `pyjs inspect URL` | Capture a screenshot and structured browser diagnostics |
499
+ | `pyjs skill` | Print version-matched instructions for coding agents |
500
+
501
+ The built-in development server is run from Python source with
502
+ `pyjs.server.dev.serve(__file__)`; generated starters and examples already
503
+ provide this entry point.
504
+
505
+ NativeScript projects can declare external npm modules without editing the
506
+ generated build directory:
507
+
508
+ ```python
509
+ from pyjs.nativescript import NativeScriptModule
510
+ from pyjs.tooling.nativescript import NativeScriptProject
511
+
512
+ widgets = NativeScriptModule("@example/widgets", "1.2.3", ("Widget",))
513
+ project = NativeScriptProject(
514
+ main,
515
+ name="Example",
516
+ app_id="org.example.app",
517
+ modules=(widgets,),
518
+ )
519
+ ```
520
+
521
+ PyJS installs the pinned package and emits its CommonJS imports before the
522
+ transpiled application bundle.
523
+
524
+ ## Current limitations and missing features
525
+
526
+ PyJS is intentionally a typed subset of Python, and the current releases remain
527
+ pre-alpha. This section summarizes the current boundary while the versioned
528
+ documentation site is being prepared.
529
+
530
+ - Multiple inheritance is not supported.
531
+ - Reflection, runtime monkey-patching, `eval()`, and arbitrary dynamic imports
532
+ are outside the compilation model.
533
+ - Python standard-library and browser API coverage is incomplete; APIs are
534
+ added as typed PyJS definitions.
535
+ - User-defined generic class specialization still has unsupported shapes and
536
+ needs dedicated regression coverage before it is considered stable.
537
+ - Some invalid programs still produce low-level analyzer errors instead of
538
+ concise diagnostics with precise source locations.
539
+ - Generated bundles include source maps back to Python. Mapping coverage and
540
+ browser-runtime presentation will continue to improve.
541
+ - The development server rebuilds when it starts, but browser hot reload is not
542
+ implemented.
543
+ - Browser-target pytest fixtures and helpers are a subset of normal pytest.
544
+ Browser tests support `pytest.raises()` as a context manager, including its
545
+ `match` argument and captured exception value.
546
+ - Tree shaking still has an `include=True` escape hatch for unusual methods
547
+ reached only through opaque JavaScript dispatch.
548
+ - Reactive effects run immediately for each attribute mutation; updates are
549
+ not currently batched.
550
+ - The bundled HTTP server and documentation server are development tools, not
551
+ production servers.
552
+ - NativeScript output currently targets Android. Core application, layout,
553
+ input, storage, drag-and-drop, screenshot, and device-test workflows work;
554
+ platform API coverage continues to expand.
555
+
556
+ Run `pyjs skill` for the installed-version guidance and `pyjs template` for
557
+ complete executable examples while the public documentation site is being
558
+ prepared.
559
+
560
+ ## Contributing
561
+
562
+ The development environment, repository structure, compiler contracts, and
563
+ verification workflow are documented in [CONTRIBUTING.md](CONTRIBUTING.md).
564
+
565
+ PyJS is distributed under the [BSD 3-Clause License](LICENSE).
566
+
567
+ [ci]: https://github.com/pyjs/pyjs/actions/workflows/ci.yml
568
+ [ci-badge]: https://github.com/pyjs/pyjs/actions/workflows/ci.yml/badge.svg
569
+ [pypi]: https://pypi.org/project/pyjs/
570
+ [pypi-badge]: https://img.shields.io/pypi/v/pyjs.svg
571
+ [python-badge]: https://img.shields.io/pypi/pyversions/pyjs.svg
572
+ [license]: LICENSE
573
+ [license-badge]: https://img.shields.io/pypi/l/pyjs.svg