pytron-kit 0.3.12__py3-none-macosx_11_0_universal2.whl

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 (419) hide show
  1. pytron/__init__.py +112 -0
  2. pytron/application.py +562 -0
  3. pytron/apputils/__init__.py +0 -0
  4. pytron/apputils/chrome_ipc.py +203 -0
  5. pytron/apputils/codegen.py +261 -0
  6. pytron/apputils/config.py +303 -0
  7. pytron/apputils/deadmansswitch.py +47 -0
  8. pytron/apputils/extras.py +76 -0
  9. pytron/apputils/native.py +148 -0
  10. pytron/apputils/shell.py +73 -0
  11. pytron/apputils/windows.py +286 -0
  12. pytron/cli.py +384 -0
  13. pytron/commands/__init__.py +0 -0
  14. pytron/commands/android.py +28 -0
  15. pytron/commands/build.py +26 -0
  16. pytron/commands/doctor.py +221 -0
  17. pytron/commands/engine.py +23 -0
  18. pytron/commands/frontend.py +60 -0
  19. pytron/commands/harvest.py +112 -0
  20. pytron/commands/helpers.py +239 -0
  21. pytron/commands/info.py +50 -0
  22. pytron/commands/init.py +521 -0
  23. pytron/commands/install.py +294 -0
  24. pytron/commands/login.py +130 -0
  25. pytron/commands/package.py +228 -0
  26. pytron/commands/plugin.py +442 -0
  27. pytron/commands/run.py +312 -0
  28. pytron/commands/scan.py +210 -0
  29. pytron/commands/show.py +23 -0
  30. pytron/commands/uninstall.py +150 -0
  31. pytron/commands/utils.py +42 -0
  32. pytron/commands/workflow.py +95 -0
  33. pytron/console.py +133 -0
  34. pytron/core.py +18 -0
  35. pytron/dependencies/WebView2Loader.dll +0 -0
  36. pytron/dependencies/__init__.py +1 -0
  37. pytron/dependencies/pytron_native.so +0 -0
  38. pytron/engines/chrome/adapter.py +445 -0
  39. pytron/engines/chrome/engine.py +576 -0
  40. pytron/engines/chrome/forge.py +147 -0
  41. pytron/engines/chrome/shell/package.json +8 -0
  42. pytron/engines/chrome/shell/preload.js +12 -0
  43. pytron/engines/chrome/shell/shell.js +534 -0
  44. pytron/exceptions.py +36 -0
  45. pytron/inspector.py +201 -0
  46. pytron/inspector_ui.py +512 -0
  47. pytron/installer/Installation.nsi +236 -0
  48. pytron/installer/header.bmp +0 -0
  49. pytron/installer/pytron.ico +0 -0
  50. pytron/installer/sidebar.bmp +0 -0
  51. pytron/llms.md +98 -0
  52. pytron/manifests/README.md +29 -0
  53. pytron/manifests/windows-utf8.manifest +44 -0
  54. pytron/menu.py +128 -0
  55. pytron/nsis-setup.exe +0 -0
  56. pytron/pack/__init__.py +0 -0
  57. pytron/pack/assets.py +131 -0
  58. pytron/pack/compilers.py +289 -0
  59. pytron/pack/crystal.py +297 -0
  60. pytron/pack/graph.py +377 -0
  61. pytron/pack/inference.py +157 -0
  62. pytron/pack/installers.py +402 -0
  63. pytron/pack/introspect.py +357 -0
  64. pytron/pack/metadata.py +213 -0
  65. pytron/pack/modules.py +618 -0
  66. pytron/pack/nuitka.py +108 -0
  67. pytron/pack/pipeline.py +107 -0
  68. pytron/pack/pyinstaller.py +176 -0
  69. pytron/pack/rust_engine.py +273 -0
  70. pytron/pack/secure.py +309 -0
  71. pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
  72. pytron/pack/secure_loader/icon.ico +0 -0
  73. pytron/pack/utils.py +110 -0
  74. pytron/pack/virtual_root.py +124 -0
  75. pytron/platforms/__init__.py +0 -0
  76. pytron/platforms/android/__init__.py +3 -0
  77. pytron/platforms/android/android.py +103 -0
  78. pytron/platforms/android/builder.py +736 -0
  79. pytron/platforms/android/ops/build.py +79 -0
  80. pytron/platforms/android/ops/init.py +63 -0
  81. pytron/platforms/android/ops/run.py +79 -0
  82. pytron/platforms/android/ops/sync.py +770 -0
  83. pytron/platforms/android/ops/utils.py +8 -0
  84. pytron/platforms/android/shell/README.md +30 -0
  85. pytron/platforms/android/shell/app/build.gradle +64 -0
  86. pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
  87. pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
  88. pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
  89. pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
  90. pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
  91. pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
  92. pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
  93. pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
  94. pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
  95. pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
  96. pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
  97. pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
  98. pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
  99. pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
  100. pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
  101. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
  102. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
  103. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
  104. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
  105. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
  106. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
  107. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
  108. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
  109. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
  110. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
  111. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
  112. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
  113. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
  114. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
  115. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
  116. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
  117. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
  118. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
  119. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
  120. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
  121. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
  122. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
  123. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
  124. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
  125. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
  126. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
  127. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
  128. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
  129. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
  130. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
  131. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
  132. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
  133. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
  134. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
  135. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
  136. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
  137. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
  138. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
  139. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
  140. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
  141. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
  142. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
  143. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
  144. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
  145. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
  146. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
  147. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
  148. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
  149. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
  150. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
  151. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
  152. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
  153. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
  154. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
  155. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
  156. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
  157. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
  158. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
  159. pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
  160. pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
  161. pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
  162. pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
  163. pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
  164. pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
  165. pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
  166. pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
  167. pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
  168. pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
  169. pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
  170. pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
  171. pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
  172. pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
  173. pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
  174. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
  175. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
  176. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
  177. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
  178. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
  179. pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
  180. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
  181. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
  182. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
  183. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
  184. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
  185. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
  186. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
  187. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
  188. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
  189. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
  190. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
  191. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
  192. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
  193. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
  194. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
  195. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
  196. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
  197. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
  198. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
  199. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
  200. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
  201. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
  202. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
  203. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
  204. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
  205. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
  206. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
  207. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
  208. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
  209. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
  210. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
  211. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
  212. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
  213. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
  214. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
  215. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
  216. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
  217. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
  218. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
  219. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
  220. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
  221. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
  222. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
  223. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
  224. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
  225. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
  226. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
  227. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
  228. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
  229. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
  230. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
  231. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
  232. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
  233. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
  234. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
  235. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
  236. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
  237. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
  238. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
  239. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
  240. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
  241. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
  242. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
  243. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
  244. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
  245. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
  246. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
  247. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
  248. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
  249. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
  250. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
  251. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
  252. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
  253. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
  254. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
  255. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
  256. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
  257. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
  258. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
  259. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
  260. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
  261. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
  262. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
  263. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
  264. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
  265. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
  266. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
  267. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
  268. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
  269. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
  270. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
  271. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
  272. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
  273. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
  274. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
  275. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
  276. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
  277. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
  278. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
  279. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
  280. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
  281. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
  282. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
  283. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
  284. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
  285. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
  286. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
  287. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
  288. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
  289. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
  290. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
  291. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
  292. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
  293. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
  294. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
  295. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
  296. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
  297. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
  298. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
  299. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
  300. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
  301. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
  302. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
  303. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
  304. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
  305. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
  306. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
  307. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
  308. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
  309. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
  310. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
  311. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
  312. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
  313. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
  314. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
  315. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
  316. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
  317. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
  318. pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
  319. pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
  320. pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
  321. pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
  322. pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
  323. pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
  324. pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
  325. pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
  326. pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
  327. pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
  328. pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
  329. pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
  330. pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
  331. pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
  332. pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
  333. pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
  334. pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
  335. pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
  336. pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
  337. pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
  338. pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
  339. pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
  340. pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
  341. pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
  342. pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
  343. pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
  344. pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
  345. pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
  346. pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
  347. pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
  348. pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
  349. pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
  350. pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
  351. pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
  352. pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
  353. pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
  354. pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
  355. pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
  356. pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
  357. pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
  358. pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
  359. pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
  360. pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
  361. pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
  362. pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
  363. pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
  364. pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
  365. pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
  366. pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
  367. pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
  368. pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
  369. pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
  370. pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
  371. pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
  372. pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
  373. pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
  374. pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
  375. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  376. pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  377. pytron/platforms/android/shell/build.gradle +11 -0
  378. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
  379. pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
  380. pytron/platforms/android/shell/gradle.properties +2 -0
  381. pytron/platforms/android/shell/gradlew.bat +85 -0
  382. pytron/platforms/android/shell/settings.gradle +16 -0
  383. pytron/platforms/darwin.py +82 -0
  384. pytron/platforms/darwin_ops/libs.py +31 -0
  385. pytron/platforms/darwin_ops/system.py +182 -0
  386. pytron/platforms/darwin_ops/utils.py +85 -0
  387. pytron/platforms/darwin_ops/webview.py +5 -0
  388. pytron/platforms/darwin_ops/window.py +102 -0
  389. pytron/platforms/interface.py +152 -0
  390. pytron/platforms/linux.py +82 -0
  391. pytron/platforms/linux_ops/libs.py +49 -0
  392. pytron/platforms/linux_ops/system.py +316 -0
  393. pytron/platforms/linux_ops/utils.py +19 -0
  394. pytron/platforms/linux_ops/webview.py +5 -0
  395. pytron/platforms/linux_ops/window.py +115 -0
  396. pytron/platforms/windows.py +136 -0
  397. pytron/platforms/windows_ops/__init__.py +0 -0
  398. pytron/platforms/windows_ops/constants.py +126 -0
  399. pytron/platforms/windows_ops/system.py +518 -0
  400. pytron/platforms/windows_ops/utils.py +3 -0
  401. pytron/platforms/windows_ops/webview.py +5 -0
  402. pytron/platforms/windows_ops/window.py +361 -0
  403. pytron/plugin.py +467 -0
  404. pytron/rcedit-x64.exe +0 -0
  405. pytron/router.py +146 -0
  406. pytron/serializer.py +240 -0
  407. pytron/shortcuts.py +279 -0
  408. pytron/state.py +76 -0
  409. pytron/tray.py +399 -0
  410. pytron/updater.py +181 -0
  411. pytron/utf8_hook.py +112 -0
  412. pytron/utils.py +44 -0
  413. pytron/webview.py +722 -0
  414. pytron_kit-0.3.12.dist-info/METADATA +131 -0
  415. pytron_kit-0.3.12.dist-info/RECORD +419 -0
  416. pytron_kit-0.3.12.dist-info/WHEEL +5 -0
  417. pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
  418. pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
  419. pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
@@ -0,0 +1,26 @@
1
+ import argparse
2
+ import shutil
3
+ import subprocess
4
+ from pathlib import Path
5
+ from .helpers import get_config
6
+
7
+
8
+ def cmd_build_frontend(args: argparse.Namespace) -> int:
9
+ folder = Path(args.folder)
10
+ if not folder.exists():
11
+ print(f"Folder not found: {folder}")
12
+ return 1
13
+
14
+ config = get_config()
15
+ provider = config.get("frontend_provider", "npm")
16
+ provider_bin = shutil.which(provider)
17
+ if not provider_bin:
18
+ print(f"{provider} not found in PATH")
19
+ return 1
20
+
21
+ print(f"Running {provider} run build in {folder}")
22
+ return subprocess.call(
23
+ [provider_bin, "run", "build"],
24
+ cwd=str(folder),
25
+ shell=False,
26
+ ) # nosec B603
@@ -0,0 +1,221 @@
1
+ import os
2
+ import sys
3
+ import shutil
4
+ import subprocess
5
+ import platform
6
+ import argparse
7
+ from pathlib import Path
8
+ from ..console import console, print_rule
9
+
10
+
11
+ def check_command(cmd, version_args=["--version", "-v", "version"]):
12
+ """Check if a command exists and return its version."""
13
+ path = shutil.which(cmd)
14
+ if not path:
15
+ return None, None
16
+
17
+ # Try common version flags
18
+ for arg in version_args:
19
+ try:
20
+ # We use shell=False for better security
21
+ result = subprocess.run(
22
+ [cmd, arg], capture_output=True, text=True, timeout=3, shell=False
23
+ ) # nosec B603
24
+ output = (result.stdout + result.stderr).strip()
25
+ if output:
26
+ # Keep only the first line of version output
27
+ version = output.split("\n")[0].strip()
28
+ return path, version
29
+ except Exception:
30
+ continue
31
+
32
+ return path, "Found"
33
+
34
+
35
+ def get_python_info():
36
+ return sys.version.split("\n")[0], platform.architecture()[0]
37
+
38
+
39
+ def cmd_doctor(args: argparse.Namespace) -> int:
40
+ print_rule("Pytron Doctor - System Diagnostic")
41
+
42
+ # 1. Core Python Info
43
+ py_ver, py_arch = get_python_info()
44
+ console.print(f"[bold]Python Environment[/bold]")
45
+ console.print(f" [success]✓[/success] Python: {py_ver} ({py_arch})")
46
+ console.print(
47
+ f" [success]✓[/success] Platform: {platform.system()} {platform.release()}"
48
+ )
49
+
50
+ # Check if in VENV
51
+ is_venv = sys.prefix != sys.base_prefix
52
+ if is_venv:
53
+ console.print(
54
+ f" [success]✓[/success] Status: Running inside a virtual environment"
55
+ )
56
+ else:
57
+ # Check for env/ in CWD
58
+ if Path("env").exists() or Path(".venv").exists():
59
+ console.print(
60
+ f" [info]i[/info] Status: Global Python (local environment detected but not active)"
61
+ )
62
+ else:
63
+ console.print(
64
+ f" [warning]![/warning] Status: Global Python (no local environment detected)"
65
+ )
66
+
67
+ console.print("")
68
+
69
+ # 2. Web Application Dependencies
70
+ console.print(f"[bold]Web & Frontend Tools[/bold]")
71
+ from .helpers import get_config
72
+
73
+ config = get_config()
74
+ configured_provider = config.get("frontend_provider", "npm")
75
+
76
+ node_path, node_ver = check_command("node")
77
+ if node_path:
78
+ console.print(f" [success]✓[/success] Node.js: {node_ver}")
79
+ else:
80
+ console.print(
81
+ f" [error]✗[/error] Node.js: Not found (Only required for 'npm/yarn/pnpm')"
82
+ )
83
+
84
+ providers = ["npm", "yarn", "pnpm", "bun"]
85
+ for p in providers:
86
+ p_path, p_ver = check_command(p)
87
+ status = "[success]✓[/success]" if p_path else "[dim]✗[/dim]"
88
+ configured_tag = (
89
+ " [cyan](Configured)[/cyan]" if p == configured_provider else ""
90
+ )
91
+ if p_path:
92
+ console.print(f" {status} {p}: {p_ver}{configured_tag}")
93
+ elif p == configured_provider:
94
+ console.print(f" [error]✗[/error] {p}: Not found{configured_tag}")
95
+ else:
96
+ console.print(f" {status} {p}: Not found")
97
+
98
+ console.print("")
99
+
100
+ # 3. Packaging Tools
101
+ console.print(f"[bold]Packaging Tools[/bold]")
102
+ pi_path, pi_ver = check_command("pyinstaller")
103
+ if pi_path:
104
+ console.print(f" [success]✓[/success] PyInstaller: {pi_ver}")
105
+ else:
106
+ # Check if installed but not in PATH
107
+ try:
108
+ from importlib.metadata import version as get_pkg_version
109
+
110
+ console.print(
111
+ f" [success]✓[/success] PyInstaller: {get_pkg_version('pyinstaller')} (accessible via module)"
112
+ )
113
+ except Exception:
114
+ console.print(
115
+ f" [error]✗[/error] PyInstaller: Not found (Required for 'pytron package')"
116
+ )
117
+
118
+ if platform.system() == "Windows":
119
+ # Check NSIS
120
+ from .package import find_makensis
121
+
122
+ makensis = find_makensis()
123
+ if makensis:
124
+ console.print(f" [success]✓[/success] NSIS: Found ({makensis})")
125
+ else:
126
+ console.print(
127
+ f" [warning]![/warning] NSIS: Not found (Required for creating installers)"
128
+ )
129
+
130
+ # Check SignTool
131
+ signtool = shutil.which("signtool")
132
+ if signtool:
133
+ console.print(f" [success]✓[/success] SignTool: Found ({signtool})")
134
+ else:
135
+ console.print(
136
+ f" [dim]i[/dim] SignTool: Not found (Optional: needed for code signing)"
137
+ )
138
+
139
+ console.print("")
140
+
141
+ # 4. Android Development
142
+ console.print(f"[bold]Android Development[/bold]")
143
+ java_path, java_ver = check_command("java")
144
+ adb_path, adb_ver = check_command("adb")
145
+ android_home = os.environ.get("ANDROID_HOME") or os.environ.get("ANDROID_SDK_ROOT")
146
+
147
+ if java_path:
148
+ console.print(f" [success]✓[/success] Java/JDK: {java_ver}")
149
+ else:
150
+ console.print(
151
+ f" [error]✗[/error] Java/JDK: Not found (Required for 'pytron android')"
152
+ )
153
+
154
+ if android_home and os.path.exists(android_home):
155
+ console.print(f" [success]✓[/success] Android SDK: {android_home}")
156
+ else:
157
+ console.print(
158
+ f" [error]✗[/error] Android SDK: ANDROID_HOME environment variable not set or invalid"
159
+ )
160
+
161
+ if adb_path:
162
+ # Clean up adb version (Android Debug Bridge version 1.0.41 -> 1.0.41)
163
+ v_clean = adb_ver.replace("Android Debug Bridge version ", "").strip()
164
+ console.print(f" [success]✓[/success] ADB: {v_clean}")
165
+ else:
166
+ console.print(
167
+ f" [warning]![/warning] ADB: Not found (Needed to run on physical devices)"
168
+ )
169
+
170
+ console.print("")
171
+
172
+ # 5. Project Integrity
173
+ if Path("settings.json").exists():
174
+ console.print(f"[bold]Project Context[/bold]")
175
+ req_json = Path("requirements.json")
176
+ if req_json.exists():
177
+ console.print(f" [success]✓[/success] requirements.json: Found")
178
+ else:
179
+ console.print(
180
+ f" [warning]![/warning] requirements.json: Missing (Run 'pytron init' or create it)"
181
+ )
182
+ console.print("")
183
+
184
+ # 6. Pytron Bridge Check
185
+ console.print(f"[bold]Pytron Core[/bold]")
186
+ try:
187
+ import pytron
188
+
189
+ pkg_root = Path(pytron.__file__).parent
190
+ console.print(f" [success]✓[/success] Pytron Location: {pkg_root.parent}")
191
+
192
+ # Check for native dynamic libraries
193
+ # Check for native dynamic libraries
194
+ from ..pack.utils import get_native_engine_binaries
195
+
196
+ needed = get_native_engine_binaries()
197
+ missing = []
198
+
199
+ for name in needed:
200
+ dll_path = pkg_root / "dependencies" / name
201
+ if not dll_path.exists():
202
+ missing.append(name)
203
+
204
+ if not missing:
205
+ console.print(
206
+ f" [success]✓[/success] Native Bridge: Found all required binaries ({', '.join(needed)})"
207
+ )
208
+ else:
209
+ console.print(
210
+ f" [error]✗[/error] Native Bridge: MISSING ({', '.join(missing)}) from {pkg_root / 'dependencies'}"
211
+ )
212
+
213
+ except Exception as e:
214
+ console.print(f" [error]✗[/error] Pytron Core: Failed to inspect ({e})")
215
+
216
+ print_rule("Diagnostic Complete", style="bold green")
217
+
218
+ console.print(
219
+ "\n[dim]If you have many [error]✗[/error], please refer to the documentation at https://pytron-kit.github.io/docs/[/dim]"
220
+ )
221
+ return 0
@@ -0,0 +1,23 @@
1
+ from ..console import log
2
+ from ..engines.chrome.forge import setup_engine
3
+
4
+
5
+ def cmd_engine(args):
6
+ """Entry point for 'pytron engine' commands."""
7
+ if not args.engine_command:
8
+ log("Usage: pytron engine <command> [args]", style="warning")
9
+ return 0
10
+
11
+ if args.engine_command == "install":
12
+ if args.name == "chrome":
13
+ log(f"Installing Chrome Mojo Engine...", style="info")
14
+ try:
15
+ target = setup_engine()
16
+ log(f"Engine Forge Successful: {target}", style="success")
17
+ except Exception as e:
18
+ log(f"Engine Forge Failed: {e}", style="error")
19
+ return 1
20
+ else:
21
+ log(f"Unsupported engine: {args.name}", style="error")
22
+ return 1
23
+ return 0
@@ -0,0 +1,60 @@
1
+ import argparse
2
+ import shutil
3
+ from pathlib import Path
4
+ from .helpers import locate_frontend_dir, get_config
5
+ from ..console import log, run_command_with_output, get_progress
6
+
7
+
8
+ def cmd_frontend(args: argparse.Namespace) -> int:
9
+ """
10
+ Proxy command that runs '<provider> <args>' in the frontend directory.
11
+ """
12
+ # Try to find frontend dir
13
+ frontend_dir = locate_frontend_dir(Path("."))
14
+
15
+ if not frontend_dir:
16
+ log("Could not locate a frontend directory (package.json).", style="error")
17
+ return 1
18
+
19
+ # Order of precedence: CLI Arg > settings.json > default 'npm'
20
+ config = get_config()
21
+ default_provider = config.get("frontend_provider", "npm")
22
+ provider = getattr(args, "provider", None) or default_provider
23
+
24
+ # Check for provider binary
25
+ provider_bin = shutil.which(provider)
26
+ if not provider_bin:
27
+ log(f"'{provider}' is not installed or not in PATH.", style="error")
28
+ return 1
29
+
30
+ npm_args = args.npm_args
31
+ if not npm_args:
32
+ # Default to 'install' if no args provided
33
+ npm_args = ["install"]
34
+
35
+ # Special case: 'install' gets the progress bar for better UX
36
+ if "install" in npm_args:
37
+ prog = get_progress()
38
+ prog.start()
39
+ task_msg = (
40
+ f"[{provider}] Installing packages..."
41
+ if len(npm_args) > 1
42
+ else f"[{provider}] Installing JS dependencies..."
43
+ )
44
+ prog.add_task(task_msg, total=None)
45
+ cmd = [provider_bin] + npm_args
46
+ ret = run_command_with_output(cmd, cwd=str(frontend_dir), shell=False)
47
+ prog.stop()
48
+ else:
49
+ # For 'run dev', 'build', etc., just stream the output directly
50
+ cmd = [provider_bin] + npm_args
51
+ log(f"Running: {provider} {' '.join(npm_args)}", style="dim")
52
+ ret = run_command_with_output(cmd, cwd=str(frontend_dir), shell=False)
53
+
54
+ if ret == 0:
55
+ log(f"Frontend command ({provider}) completed successfully.", style="success")
56
+ else:
57
+ log(f"Command failed ({provider} {' '.join(npm_args)})", style="error")
58
+ return 1
59
+
60
+ return 0
@@ -0,0 +1,112 @@
1
+ from importlib import metadata as importlib_metadata
2
+ from pathlib import Path
3
+ from typing import Iterable
4
+
5
+
6
+ def generate_nuclear_hooks(
7
+ output_dir: Path,
8
+ collect_all_mode: bool = True,
9
+ blacklist: Iterable[str] | None = None,
10
+ search_path: list[str] | None = None,
11
+ whitelist: Iterable[str] | None = None,
12
+ ) -> None:
13
+ """
14
+ Scans the current Python environment and writes PyInstaller hook files that
15
+ call `collect_all` (or `collect_submodules` if `collect_all_mode` is False)
16
+ for each installed distribution. Hooks are written as `hook-<package>.py`.
17
+
18
+ Parameters:
19
+ - output_dir: directory to place generated hook files
20
+ - collect_all_mode: if True use `collect_all`, else use `collect_submodules`
21
+ - blacklist: optional iterable of package names to skip (case-insensitive)
22
+ - search_path: optional list of paths to search for distributions (defaults to sys.path)
23
+ - whitelist: optional iterable of package names to ONLY include (overrides scan)
24
+ """
25
+ output_dir = Path(output_dir)
26
+ output_dir.mkdir(parents=True, exist_ok=True)
27
+ print(f"[Pytron] Initiating Complete Hook Generation in {output_dir}...")
28
+
29
+ if blacklist is None:
30
+ blacklist = [
31
+ "pyinstaller",
32
+ "pytron-kit",
33
+ "setuptools",
34
+ "pip",
35
+ "wheel",
36
+ "altgraph",
37
+ "pefile",
38
+ "pyinstaller-hooks-contrib",
39
+ ]
40
+
41
+ bl = {n.lower() for n in blacklist}
42
+ wl = {n.lower() for n in whitelist} if whitelist else None
43
+
44
+ count = 0
45
+ # Use the provided search_path if available
46
+ dists = (
47
+ importlib_metadata.distributions(path=search_path)
48
+ if search_path
49
+ else importlib_metadata.distributions()
50
+ )
51
+
52
+ for dist in dists:
53
+ # Try to obtain a project/distribution name comparable to pkg_resources' project_name
54
+ name = None
55
+ try:
56
+ # metadata is an email.message.Message mapping; 'Name' is the canonical key
57
+ name = dist.metadata.get("Name") or getattr(dist, "name", None)
58
+ except Exception:
59
+ try:
60
+ name = getattr(dist, "name", None)
61
+ except Exception:
62
+ name = None
63
+
64
+ if not name:
65
+ # fallback: try the package root name derived from the distribution path
66
+ try:
67
+ name = Path(dist.locate_file("")).name
68
+ except Exception:
69
+ continue
70
+
71
+ if wl is not None:
72
+ # If whitelist is provided, skip if not in it
73
+ if name.lower() not in wl:
74
+ continue
75
+
76
+ if name.lower() in bl:
77
+ continue
78
+
79
+ safe_name = name.replace("-", "_")
80
+
81
+ func = "collect_all" if collect_all_mode else "collect_submodules"
82
+
83
+ if collect_all_mode:
84
+ body = f"binaries, hiddenimports, datas = collect_all('{name}')"
85
+ else:
86
+ body = f"hiddenimports = collect_submodules('{name}')\n binaries, datas = [], []"
87
+
88
+ hook_content = f"""
89
+ # Auto-generated nuclear hook for {name}
90
+ from PyInstaller.utils.hooks import {func}
91
+
92
+ try:
93
+ {body}
94
+ except Exception:
95
+ # Fallback on any error to keep build moving
96
+ binaries, hiddenimports, datas = [], [], []
97
+ """
98
+
99
+ hook_file = output_dir / f"hook-{safe_name}.py"
100
+ try:
101
+ hook_file.write_text(hook_content, encoding="utf-8")
102
+ count += 1
103
+ except Exception as e:
104
+ print(f"[Pytron] Warning: failed to write hook for {name}: {e}")
105
+
106
+ print(
107
+ f"[Pytron] Generated {count} complete hooks. PyInstaller can't miss anything now."
108
+ )
109
+
110
+
111
+ if __name__ == "__main__":
112
+ generate_nuclear_hooks(Path("temp_hooks"))
@@ -0,0 +1,239 @@
1
+ from __future__ import annotations
2
+ import shutil
3
+ import subprocess
4
+ import json
5
+ import sys
6
+ from pathlib import Path
7
+
8
+
9
+ def get_venv_python_path(venv_dir: Path = Path("env")) -> Path:
10
+ if sys.platform == "win32":
11
+ return venv_dir / "Scripts" / "python.exe"
12
+ return venv_dir / "bin" / "python"
13
+
14
+
15
+ def get_python_executable() -> str:
16
+ venv_python = get_venv_python_path()
17
+ if venv_python.exists():
18
+ return str(venv_python)
19
+ return sys.executable
20
+
21
+
22
+ def get_config() -> dict:
23
+ """Load settings.json from the current directory."""
24
+ path = Path("settings.json")
25
+ if path.exists():
26
+ try:
27
+ return json.loads(path.read_text(encoding="utf-8"))
28
+ except Exception as e:
29
+ # Config file might be corrupted or unreadable
30
+ print(f"[Pytron] Debug: Failed to load settings.json: {e}")
31
+ return {}
32
+
33
+
34
+ def get_venv_site_packages(python_exe: str) -> list[str]:
35
+ """
36
+ Get the site-packages directories for the given python executable.
37
+ """
38
+ try:
39
+ # We use a subprocess to ask the venv python where its site-packages are.
40
+ # We use json to safely parse the list.
41
+ cmd = [
42
+ python_exe,
43
+ "-c",
44
+ "import site; import json; print(json.dumps(site.getsitepackages()))",
45
+ ]
46
+ output = subprocess.check_output(cmd, text=True).strip()
47
+ return json.loads(output)
48
+ except Exception as e:
49
+ print(
50
+ f"[Pytron] Warning: Could not determine site-packages for {python_exe}: {e}"
51
+ )
52
+ return []
53
+
54
+
55
+ def locate_frontend_dir(start_dir: Path | None = None) -> Path | None:
56
+ base = (start_dir or Path(".")).resolve()
57
+ if not base.exists():
58
+ return None
59
+ candidates = [base]
60
+ # Ignores common large folders to avoid slow searches and false positives
61
+ ignored_dirs = {"node_modules", "env", "venv", ".git", "build", "dist"}
62
+ candidates.extend(
63
+ [
64
+ p
65
+ for p in base.iterdir()
66
+ if p.is_dir() and p.name not in ignored_dirs and not p.name.startswith(".")
67
+ ]
68
+ )
69
+ for candidate in candidates:
70
+ pkg = candidate / "package.json"
71
+ if not pkg.exists():
72
+ continue
73
+ try:
74
+ data = json.loads(pkg.read_text())
75
+ except json.JSONDecodeError:
76
+ # Skip invalid package.json
77
+ continue
78
+ if isinstance(data.get("scripts"), dict) and "build" in data["scripts"]:
79
+ return candidate.resolve()
80
+ return None
81
+
82
+
83
+ def run_frontend_build(frontend_dir: Path) -> bool | None:
84
+ config = get_config()
85
+ provider = config.get("frontend_provider", "npm")
86
+ provider_bin = shutil.which(provider)
87
+
88
+ if not provider_bin:
89
+ print(f"[Pytron] {provider} not found, skipping frontend build.")
90
+ return None
91
+
92
+ print(f"[Pytron] Building frontend at: {frontend_dir} using {provider}")
93
+ # Ensure Next.js static export-friendly config when applicable
94
+ # Determine if this is a Next.js project and ensure config if so
95
+ is_next = False
96
+ try:
97
+ pkg = json.loads((frontend_dir / "package.json").read_text())
98
+ if "next" in pkg.get("dependencies", {}) or "next" in pkg.get(
99
+ "devDependencies", {}
100
+ ):
101
+ ensure_next_config(frontend_dir)
102
+ patch_nextjs_defaults(frontend_dir) # Patch default template paths
103
+ is_next = True
104
+ except Exception as e:
105
+ print(f"[Pytron] Debug: Failed to patch Next.js config: {e}")
106
+
107
+ try:
108
+ # If this is a Next.js project, prefer npx/bunx/pnpx next build (and export)
109
+ if is_next:
110
+ runner = "npx"
111
+ if provider == "bun":
112
+ runner = "bunx"
113
+ elif provider == "pnpm":
114
+ runner = "pnpx"
115
+
116
+ print(f"[Pytron] Detected Next.js project — running `{runner} next build`.")
117
+ # Run build to create a static `out/` directory (Next.js 13.4+ with output: "export")
118
+ subprocess.run(
119
+ [runner, "next", "build"],
120
+ cwd=str(frontend_dir),
121
+ shell=False,
122
+ check=True,
123
+ )
124
+ return True
125
+
126
+ # Fallback to the project's build script via provider
127
+ subprocess.run(
128
+ [provider_bin, "run", "build"],
129
+ cwd=str(frontend_dir),
130
+ shell=False,
131
+ check=True,
132
+ )
133
+ return True
134
+ except subprocess.CalledProcessError as exc:
135
+ print(f"[Pytron] Frontend build failed: {exc}")
136
+ return False
137
+
138
+
139
+ def patch_nextjs_defaults(frontend_dir: Path):
140
+ """
141
+ Patches default Next.js template files to use relative paths for static assets.
142
+ This fixes issues where /next.svg resolves to file:///next.svg instead of relative to the HTML file.
143
+ """
144
+ # 1. Patch page.tsx / page.js (Fixes Image src)
145
+ for ext in ["tsx", "jsx", "js", "ts"]:
146
+ page_file = frontend_dir / "src" / "app" / f"page.{ext}"
147
+ if not page_file.exists():
148
+ page_file = frontend_dir / "app" / f"page.{ext}" # Older structure
149
+
150
+ if page_file.exists():
151
+ try:
152
+ content = page_file.read_text(encoding="utf-8")
153
+ new_content = content
154
+ # Replace absolute paths with relative ones
155
+ replacements = {
156
+ 'src="/next.svg"': 'src="./next.svg"',
157
+ 'src="/vercel.svg"': 'src="./vercel.svg"',
158
+ "src='/next.svg'": "src='./next.svg'",
159
+ "src='/vercel.svg'": "src='./vercel.svg'",
160
+ }
161
+ for old, new in replacements.items():
162
+ new_content = new_content.replace(old, new)
163
+
164
+ if new_content != content:
165
+ page_file.write_text(new_content, encoding="utf-8")
166
+ print(
167
+ f"[Pytron] Patched {page_file.name} to use relative image paths."
168
+ )
169
+ except Exception as e:
170
+ print(f"[Pytron] Warning: Failed to patch {page_file.name}: {e}")
171
+
172
+ # 2. Patch layout.tsx / layout.js (Fixes favicon)
173
+ # Note: Next.js App Router handles favicon via convention (favicon.ico in app/ or public/),
174
+ # but sometimes it's manually referenced in layout or head.
175
+ # However, the default create-next-app usually relies on the file presence.
176
+ # If the user sees 404 for favicon, it might be due to <link rel="icon" href="/favicon.ico"> generated by Next.
177
+ # We can't easily patch the internal generation of that link without a custom Head component or metadata.
178
+ # But if it's in the code:
179
+ for ext in ["tsx", "jsx", "js", "ts"]:
180
+ layout_file = frontend_dir / "src" / "app" / f"layout.{ext}"
181
+ if not layout_file.exists():
182
+ layout_file = frontend_dir / "app" / f"layout.{ext}"
183
+
184
+ if layout_file.exists():
185
+ try:
186
+ content = layout_file.read_text(encoding="utf-8")
187
+ # Check for manual link tags if any (unlikely in new app router but possible)
188
+ if 'href="/favicon.ico"' in content:
189
+ new_content = content.replace(
190
+ 'href="/favicon.ico"', 'href="./favicon.ico"'
191
+ )
192
+ layout_file.write_text(new_content, encoding="utf-8")
193
+ print(
194
+ f"[Pytron] Patched {layout_file.name} to use relative favicon path."
195
+ )
196
+ except Exception as e:
197
+ print(f"[Pytron] Debug: Failed to patch layout file: {e}")
198
+
199
+
200
+ def ensure_next_config(frontend_dir: Path) -> bool:
201
+ """Ensure a `next.config.js` exists with static-export friendly settings.
202
+
203
+ If no `next.config.js` exists, create one with the recommended config.
204
+ If one exists but doesn't already set `output: 'export'`, back it up and overwrite
205
+ with the recommended config. Returns True if a file was created/overwritten,
206
+ False if no change was necessary.
207
+ """
208
+ next_config = frontend_dir / "next.config.js"
209
+ desired = """/** @type {import('next').NextConfig} */
210
+ const nextConfig = {
211
+ output: 'export', // required to generate static files (out/)
212
+ images: { unoptimized: true }, // so Next won’t rewrite image loaders
213
+ assetPrefix: './', // makes asset paths relative
214
+ };
215
+
216
+ module.exports = nextConfig;
217
+ """
218
+ try:
219
+ if not next_config.exists():
220
+ next_config.write_text(desired, encoding="utf-8")
221
+ print(f"[Pytron] Created {next_config} to enable static export.")
222
+ return True
223
+ content = next_config.read_text(encoding="utf-8")
224
+ if ("output: 'export'" in content or 'output: "export"' in content) and (
225
+ "assetPrefix: './'" in content or 'assetPrefix: "./"' in content
226
+ ):
227
+ print(f"[Pytron] {next_config} already configures static export.")
228
+ return False
229
+ # Backup and overwrite to ensure static-friendly config
230
+ backup = frontend_dir / "next.config.js.bak"
231
+ backup.write_text(content, encoding="utf-8")
232
+ next_config.write_text(desired, encoding="utf-8")
233
+ print(
234
+ f"[Pytron] Backed up existing next.config.js to {backup} and injected export config."
235
+ )
236
+ return True
237
+ except Exception as exc:
238
+ print(f"[Pytron] Warning: could not ensure next.config.js: {exc}")
239
+ return False