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.
- pytron/__init__.py +112 -0
- pytron/application.py +562 -0
- pytron/apputils/__init__.py +0 -0
- pytron/apputils/chrome_ipc.py +203 -0
- pytron/apputils/codegen.py +261 -0
- pytron/apputils/config.py +303 -0
- pytron/apputils/deadmansswitch.py +47 -0
- pytron/apputils/extras.py +76 -0
- pytron/apputils/native.py +148 -0
- pytron/apputils/shell.py +73 -0
- pytron/apputils/windows.py +286 -0
- pytron/cli.py +384 -0
- pytron/commands/__init__.py +0 -0
- pytron/commands/android.py +28 -0
- pytron/commands/build.py +26 -0
- pytron/commands/doctor.py +221 -0
- pytron/commands/engine.py +23 -0
- pytron/commands/frontend.py +60 -0
- pytron/commands/harvest.py +112 -0
- pytron/commands/helpers.py +239 -0
- pytron/commands/info.py +50 -0
- pytron/commands/init.py +521 -0
- pytron/commands/install.py +294 -0
- pytron/commands/login.py +130 -0
- pytron/commands/package.py +228 -0
- pytron/commands/plugin.py +442 -0
- pytron/commands/run.py +312 -0
- pytron/commands/scan.py +210 -0
- pytron/commands/show.py +23 -0
- pytron/commands/uninstall.py +150 -0
- pytron/commands/utils.py +42 -0
- pytron/commands/workflow.py +95 -0
- pytron/console.py +133 -0
- pytron/core.py +18 -0
- pytron/dependencies/WebView2Loader.dll +0 -0
- pytron/dependencies/__init__.py +1 -0
- pytron/dependencies/pytron_native.so +0 -0
- pytron/engines/chrome/adapter.py +445 -0
- pytron/engines/chrome/engine.py +576 -0
- pytron/engines/chrome/forge.py +147 -0
- pytron/engines/chrome/shell/package.json +8 -0
- pytron/engines/chrome/shell/preload.js +12 -0
- pytron/engines/chrome/shell/shell.js +534 -0
- pytron/exceptions.py +36 -0
- pytron/inspector.py +201 -0
- pytron/inspector_ui.py +512 -0
- pytron/installer/Installation.nsi +236 -0
- pytron/installer/header.bmp +0 -0
- pytron/installer/pytron.ico +0 -0
- pytron/installer/sidebar.bmp +0 -0
- pytron/llms.md +98 -0
- pytron/manifests/README.md +29 -0
- pytron/manifests/windows-utf8.manifest +44 -0
- pytron/menu.py +128 -0
- pytron/nsis-setup.exe +0 -0
- pytron/pack/__init__.py +0 -0
- pytron/pack/assets.py +131 -0
- pytron/pack/compilers.py +289 -0
- pytron/pack/crystal.py +297 -0
- pytron/pack/graph.py +377 -0
- pytron/pack/inference.py +157 -0
- pytron/pack/installers.py +402 -0
- pytron/pack/introspect.py +357 -0
- pytron/pack/metadata.py +213 -0
- pytron/pack/modules.py +618 -0
- pytron/pack/nuitka.py +108 -0
- pytron/pack/pipeline.py +107 -0
- pytron/pack/pyinstaller.py +176 -0
- pytron/pack/rust_engine.py +273 -0
- pytron/pack/secure.py +309 -0
- pytron/pack/secure_loader/bin/pytron_rust_bootloader +0 -0
- pytron/pack/secure_loader/icon.ico +0 -0
- pytron/pack/utils.py +110 -0
- pytron/pack/virtual_root.py +124 -0
- pytron/platforms/__init__.py +0 -0
- pytron/platforms/android/__init__.py +3 -0
- pytron/platforms/android/android.py +103 -0
- pytron/platforms/android/builder.py +736 -0
- pytron/platforms/android/ops/build.py +79 -0
- pytron/platforms/android/ops/init.py +63 -0
- pytron/platforms/android/ops/run.py +79 -0
- pytron/platforms/android/ops/sync.py +770 -0
- pytron/platforms/android/ops/utils.py +8 -0
- pytron/platforms/android/shell/README.md +30 -0
- pytron/platforms/android/shell/app/build.gradle +64 -0
- pytron/platforms/android/shell/app/src/main/AndroidManifest.xml +29 -0
- pytron/platforms/android/shell/app/src/main/assets/python/main.py +86 -0
- pytron/platforms/android/shell/app/src/main/assets/python/python314.zip +0 -0
- pytron/platforms/android/shell/app/src/main/cpp/CMakeLists.txt +25 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/Python.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/abstract.h +915 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/audit.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bltinmodule.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/boolobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytearrayobject.h +44 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/bytesobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/ceval.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/codecs.h +176 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/compile.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/complexobject.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/abstract.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/audit.h +8 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytearrayobject.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/bytesobject.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/cellobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/ceval.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/classobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/code.h +340 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/compile.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/complexobject.h +33 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/context.h +107 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/critical_section.h +154 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/descrobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/dictobject.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileobject.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/fileutils.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/floatobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/frameobject.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/funcobject.h +185 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/genobject.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/import.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/initconfig.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/listobject.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/lock.h +74 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longintrepr.h +184 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/longobject.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/memoryobject.h +50 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/methodobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/modsupport.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/monitoring.h +269 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/object.h +493 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/objimpl.h +104 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/odictobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/picklebufobject.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pthread_stubs.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic.h +614 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_gcc.h +615 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_msc.h +1197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyatomic_std.h +1112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyctype.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pydebug.h +38 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyerrors.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyfpe.h +15 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyframe.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pyhash.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pylifecycle.h +89 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pymem.h +84 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystate.h +275 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pystats.h +194 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythonrun.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pythread.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/pytime.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/setobject.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/traceback.h +13 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tracemalloc.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/tupleobject.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/unicodeobject.h +773 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/warnings.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/cpython/weakrefobject.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/critical_section.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/datetime.h +267 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/descrobject.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dictobject.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/dynamic_annotations.h +499 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/enumobject.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/errcode.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/exports.h +105 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/fileutils.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/floatobject.h +54 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/frameobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/genericaliasobject.h +14 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/import.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/atomic.h +392 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/internal.h +969 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/prim.h +329 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/track.h +147 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc/types.h +721 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/mimalloc/mimalloc.h +565 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_abstract.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_asdl.h +112 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast.h +945 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ast_state.h +271 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_atexit.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_audit.h +35 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_backoff.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bitutils.h +186 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_blocks_output_buffer.h +321 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_brc.h +73 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytes_methods.h +82 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_bytesobject.h +149 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_c_array.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_call.h +206 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_capsule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_cell.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval.h +390 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ceval_state.h +48 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_code.h +671 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_codecs.h +76 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_compile.h +230 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_complexobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_condvar.h +93 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_context.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_critical_section.h +237 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp.h +406 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_crossinterp_data_registry.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_debug_offsets.h +379 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_descrobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict.h +410 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dict_state.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_dtoa.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_signal.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_emscripten_trampoline.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_exceptions.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_faulthandler.h +100 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils.h +320 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_fileutils_windows.h +98 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_floatobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_flowgraph.h +47 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_format.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_frame.h +61 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_freelist_state.h +70 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_function.h +53 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gc.h +378 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_genobject.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_getopt.h +22 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_gil.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_objects_fini_generated.h +1592 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_global_strings.h +854 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hamt.h +113 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_hashtable.h +150 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_import.h +141 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_importdl.h +139 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_index_pool.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_initconfig.h +197 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruction_sequence.h +83 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_instruments.h +127 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp.h +109 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interp_structs.h +977 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe.h +401 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpframe_structs.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_interpolation.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_intrinsics.h +51 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_jit.h +29 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_list.h +81 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_llist.h +106 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_lock.h +236 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_long.h +319 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_magic_number.h +305 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_memoryobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_mimalloc.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_modsupport.h +99 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_moduleobject.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_namespace.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_alloc.h +71 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_deferred.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_stack.h +95 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_object_state.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc.h +702 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_obmalloc_init.h +66 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_metadata.h +2117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_opcode_utils.h +90 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_optimizer.h +318 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parking_lot.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_parser.h +78 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pathconfig.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyarena.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyatomic_ft_wrappers.h +174 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pybuffer.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyerrors.h +213 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pyhash.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pylifecycle.h +136 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymath.h +205 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pymem_init.h +103 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystate.h +339 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pystats.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythonrun.h +68 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_pythread.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_qsbr.h +172 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_range.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime.h +63 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init.h +239 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_init_generated.h +1589 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_runtime_structs.h +310 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_semaphore.h +67 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_setobject.h +41 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_signal.h +108 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sliceobject.h +20 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stackref.h +791 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_stats.h +97 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_strhex.h +39 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structs.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_structseq.h +40 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_symtable.h +201 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_sysmodule.h +32 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_template.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_time.h +334 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_token.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_traceback.h +111 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tracemalloc.h +164 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tstate.h +88 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_tuple.h +75 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typedefs.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typeobject.h +155 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_typevarobject.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_ucnhash.h +36 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject.h +308 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unicodeobject_generated.h +3132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_unionobject.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uniqueid.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_ids.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_uop_metadata.h +1204 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_warnings.h +21 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/internal/pycore_weakref.h +133 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/intrcheck.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/iterobject.h +24 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/listobject.h +55 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/lock.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/longobject.h +178 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/marshal.h +31 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/memoryobject.h +34 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/methodobject.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/modsupport.h +146 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/moduleobject.h +122 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/monitoring.h +18 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/object.h +828 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/objimpl.h +211 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode.h +43 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/opcode_ids.h +259 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osdefs.h +57 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/osmodule.h +17 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/patchlevel.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/py_curses.h +117 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyatomic.h +16 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pybuffer.h +145 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pycapsule.h +58 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyconfig.h +2088 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pydtrace.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyerrors.h +335 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyexpat.h +62 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyframe.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyhash.h +59 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pylifecycle.h +80 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacconfig.h +91 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymacro.h +243 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymath.h +65 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pymem.h +110 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pyport.h +710 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystate.h +132 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystats.h +28 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrcmp.h +23 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pystrtod.h +37 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythonrun.h +42 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pythread.h +131 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/pytypedefs.h +30 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/rangeobject.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/refcount.h +555 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/setobject.h +49 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sliceobject.h +69 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structmember.h +56 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/structseq.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/sysmodule.h +27 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/traceback.h +26 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/tupleobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/typeslots.h +96 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/unicodeobject.h +1029 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/warnings.h +45 -0
- pytron/platforms/android/shell/app/src/main/cpp/include/weakrefobject.h +46 -0
- pytron/platforms/android/shell/app/src/main/cpp/pytron_bridge.cpp +224 -0
- pytron/platforms/android/shell/app/src/main/java/com/pytron/shell/MainActivity.kt +208 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- pytron/platforms/android/shell/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- pytron/platforms/android/shell/build.gradle +11 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.jar +0 -0
- pytron/platforms/android/shell/gradle/wrapper/gradle-wrapper.properties +5 -0
- pytron/platforms/android/shell/gradle.properties +2 -0
- pytron/platforms/android/shell/gradlew.bat +85 -0
- pytron/platforms/android/shell/settings.gradle +16 -0
- pytron/platforms/darwin.py +82 -0
- pytron/platforms/darwin_ops/libs.py +31 -0
- pytron/platforms/darwin_ops/system.py +182 -0
- pytron/platforms/darwin_ops/utils.py +85 -0
- pytron/platforms/darwin_ops/webview.py +5 -0
- pytron/platforms/darwin_ops/window.py +102 -0
- pytron/platforms/interface.py +152 -0
- pytron/platforms/linux.py +82 -0
- pytron/platforms/linux_ops/libs.py +49 -0
- pytron/platforms/linux_ops/system.py +316 -0
- pytron/platforms/linux_ops/utils.py +19 -0
- pytron/platforms/linux_ops/webview.py +5 -0
- pytron/platforms/linux_ops/window.py +115 -0
- pytron/platforms/windows.py +136 -0
- pytron/platforms/windows_ops/__init__.py +0 -0
- pytron/platforms/windows_ops/constants.py +126 -0
- pytron/platforms/windows_ops/system.py +518 -0
- pytron/platforms/windows_ops/utils.py +3 -0
- pytron/platforms/windows_ops/webview.py +5 -0
- pytron/platforms/windows_ops/window.py +361 -0
- pytron/plugin.py +467 -0
- pytron/rcedit-x64.exe +0 -0
- pytron/router.py +146 -0
- pytron/serializer.py +240 -0
- pytron/shortcuts.py +279 -0
- pytron/state.py +76 -0
- pytron/tray.py +399 -0
- pytron/updater.py +181 -0
- pytron/utf8_hook.py +112 -0
- pytron/utils.py +44 -0
- pytron/webview.py +722 -0
- pytron_kit-0.3.12.dist-info/METADATA +131 -0
- pytron_kit-0.3.12.dist-info/RECORD +419 -0
- pytron_kit-0.3.12.dist-info/WHEEL +5 -0
- pytron_kit-0.3.12.dist-info/entry_points.txt +2 -0
- pytron_kit-0.3.12.dist-info/licenses/LICENSE +201 -0
- pytron_kit-0.3.12.dist-info/top_level.txt +1 -0
pytron/commands/info.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
import os
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def cmd_info(args: argparse.Namespace) -> int:
|
|
8
|
+
try:
|
|
9
|
+
from pytron import __version__ # type: ignore
|
|
10
|
+
except Exception:
|
|
11
|
+
__version__ = "Unknown"
|
|
12
|
+
|
|
13
|
+
print("Pytron CLI Info")
|
|
14
|
+
print("---------------")
|
|
15
|
+
print(f"Installed Pytron Version: {__version__}")
|
|
16
|
+
print(f"Python Version: {sys.version.splitlines()[0]}")
|
|
17
|
+
print(f"Platform: {sys.platform}")
|
|
18
|
+
|
|
19
|
+
# Check for project settings
|
|
20
|
+
cwd = os.getcwd()
|
|
21
|
+
settings_path = os.path.join(cwd, "settings.json")
|
|
22
|
+
|
|
23
|
+
if os.path.exists(settings_path):
|
|
24
|
+
print("\nProject Details (from settings.json)")
|
|
25
|
+
print("------------------------------------")
|
|
26
|
+
try:
|
|
27
|
+
with open(settings_path, "r") as f:
|
|
28
|
+
settings = json.load(f)
|
|
29
|
+
|
|
30
|
+
project_version = settings.get("pytron_version", "Not specified")
|
|
31
|
+
frontend = settings.get("frontend_framework", "Not specified")
|
|
32
|
+
title = settings.get("title", "Not specified")
|
|
33
|
+
|
|
34
|
+
print(f"Project Name: {title}")
|
|
35
|
+
print(f"Project Pytron Version: {project_version}")
|
|
36
|
+
print(f"Frontend Framework: {frontend}")
|
|
37
|
+
|
|
38
|
+
if project_version != "Not specified" and project_version != __version__:
|
|
39
|
+
print(
|
|
40
|
+
f"\nWarning: Project version ({project_version}) differs from installed version ({__version__})"
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
except Exception as e:
|
|
44
|
+
print(f"Error reading settings.json: {e}")
|
|
45
|
+
else:
|
|
46
|
+
print(
|
|
47
|
+
"\nNo settings.json found in current directory (not a Pytron project root?)"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return 0
|
pytron/commands/init.py
ADDED
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import subprocess
|
|
3
|
+
import argparse
|
|
4
|
+
import shutil
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from ..console import (
|
|
8
|
+
log,
|
|
9
|
+
console,
|
|
10
|
+
get_progress,
|
|
11
|
+
print_rule,
|
|
12
|
+
run_command_with_output,
|
|
13
|
+
)
|
|
14
|
+
from .. import __version__
|
|
15
|
+
|
|
16
|
+
TEMPLATE_APP = """from pytron import App
|
|
17
|
+
|
|
18
|
+
def main():
|
|
19
|
+
app = App()
|
|
20
|
+
|
|
21
|
+
# Expose Python function to Frontend
|
|
22
|
+
@app.expose
|
|
23
|
+
def greet(name):
|
|
24
|
+
return f"Hello, {name}! From Python"
|
|
25
|
+
|
|
26
|
+
app.run()
|
|
27
|
+
|
|
28
|
+
if __name__ == '__main__':
|
|
29
|
+
main()
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_frontend_runner(provider: str) -> str:
|
|
34
|
+
if provider == "bun":
|
|
35
|
+
return "bunx"
|
|
36
|
+
if provider == "pnpm":
|
|
37
|
+
return "pnpx"
|
|
38
|
+
return "npx"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def cmd_init(args: argparse.Namespace) -> int:
|
|
42
|
+
target = Path(args.target).resolve()
|
|
43
|
+
if target.exists():
|
|
44
|
+
log(f"Target '{target}' already exists", style="error")
|
|
45
|
+
return 1
|
|
46
|
+
|
|
47
|
+
print_rule(f"Initializing Pytron App: {target.name}")
|
|
48
|
+
log(f"Creating project at: {target}")
|
|
49
|
+
target.mkdir(parents=True)
|
|
50
|
+
|
|
51
|
+
# Create app.py
|
|
52
|
+
app_file = target / "app.py"
|
|
53
|
+
app_file.write_text(TEMPLATE_APP, encoding="utf-8")
|
|
54
|
+
|
|
55
|
+
# Create settings.json
|
|
56
|
+
is_next = args.template.lower() in ["next", "nextjs"]
|
|
57
|
+
dist_path = "frontend/out/index.html" if is_next else "frontend/dist/index.html"
|
|
58
|
+
|
|
59
|
+
# Resolve provider
|
|
60
|
+
provider = getattr(args, "provider", "npm")
|
|
61
|
+
provider_bin = shutil.which(provider)
|
|
62
|
+
if not provider_bin:
|
|
63
|
+
log(f"Warning: '{provider}' not found. Defaulting to 'npm'.", style="warning")
|
|
64
|
+
provider = "npm"
|
|
65
|
+
|
|
66
|
+
settings_file = target / "settings.json"
|
|
67
|
+
settings_data = {
|
|
68
|
+
# Identity
|
|
69
|
+
"title": target.name,
|
|
70
|
+
"version": "1.0.0",
|
|
71
|
+
"author": "Your Name",
|
|
72
|
+
"description": "A brief description of your app",
|
|
73
|
+
"copyright": f"Copyright \u00a9 2026 Your Name",
|
|
74
|
+
"pytron_version": __version__,
|
|
75
|
+
# Window Configuration
|
|
76
|
+
"dimensions": [800, 600],
|
|
77
|
+
"min_size": None,
|
|
78
|
+
"max_size": None,
|
|
79
|
+
"resizable": True,
|
|
80
|
+
"frameless": False,
|
|
81
|
+
"fullscreen": False,
|
|
82
|
+
"always_on_top": False,
|
|
83
|
+
"transparent": False,
|
|
84
|
+
"background_color": "#ffffff",
|
|
85
|
+
"start_maximized": False,
|
|
86
|
+
"start_hidden": False,
|
|
87
|
+
"default_context_menu": False,
|
|
88
|
+
# Application
|
|
89
|
+
"url": dist_path,
|
|
90
|
+
"icon": "pytron.ico",
|
|
91
|
+
"engine": "native", # Options: 'native', 'chrome'
|
|
92
|
+
"single_instance": True,
|
|
93
|
+
"close_to_tray": False,
|
|
94
|
+
"debug": False,
|
|
95
|
+
# Frontend
|
|
96
|
+
"frontend_framework": args.template,
|
|
97
|
+
"frontend_provider": provider,
|
|
98
|
+
"dev_port": None,
|
|
99
|
+
# Plugins
|
|
100
|
+
"plugins_dir": None,
|
|
101
|
+
"plugins": [],
|
|
102
|
+
# Packaging & Build
|
|
103
|
+
"crystal_mode": False, # High-Security Runtime Audit
|
|
104
|
+
"virtual_entry_point": False, # Synthesized Entry Point Strategy
|
|
105
|
+
"splash_image": None,
|
|
106
|
+
"force-package": [],
|
|
107
|
+
"include_patterns": [],
|
|
108
|
+
"exclude_patterns": [],
|
|
109
|
+
"macos_plist": {},
|
|
110
|
+
"signing": {},
|
|
111
|
+
}
|
|
112
|
+
settings_file.write_text(json.dumps(settings_data, indent=4))
|
|
113
|
+
|
|
114
|
+
# Copy Pytron icon
|
|
115
|
+
try:
|
|
116
|
+
pytron_pkg_dir = Path(__file__).resolve().parent.parent
|
|
117
|
+
default_icon_src = pytron_pkg_dir / "installer" / "pytron.ico"
|
|
118
|
+
if default_icon_src.exists():
|
|
119
|
+
shutil.copy2(default_icon_src, target / "pytron.ico")
|
|
120
|
+
log("Added default Pytron icon", style="success")
|
|
121
|
+
except Exception as e:
|
|
122
|
+
log(f"Warning: Could not copy default icon: {e}", style="warning")
|
|
123
|
+
|
|
124
|
+
progress = get_progress()
|
|
125
|
+
progress.start()
|
|
126
|
+
task = progress.add_task("Initializing...", total=100)
|
|
127
|
+
|
|
128
|
+
# Initialize Frontend
|
|
129
|
+
if is_next:
|
|
130
|
+
log("Initializing Next.js app...", style="info")
|
|
131
|
+
progress.update(task, description="Creating Next.js App...", completed=10)
|
|
132
|
+
try:
|
|
133
|
+
# npx create-next-app@latest frontend --use-npm --no-git --ts --eslint --no-tailwind --src-dir --app --import-alias "@/*"
|
|
134
|
+
# Using defaults but forcing non-interactive
|
|
135
|
+
runner = "npx"
|
|
136
|
+
if provider == "bun":
|
|
137
|
+
runner = "bunx"
|
|
138
|
+
elif provider == "pnpm":
|
|
139
|
+
runner = "pnpx"
|
|
140
|
+
|
|
141
|
+
# Resolve full path for Windows compatibility (npx.cmd)
|
|
142
|
+
runner_path = shutil.which(runner)
|
|
143
|
+
if runner_path:
|
|
144
|
+
runner = runner_path
|
|
145
|
+
|
|
146
|
+
cmd = [
|
|
147
|
+
runner,
|
|
148
|
+
"-y",
|
|
149
|
+
"create-next-app@latest",
|
|
150
|
+
"frontend",
|
|
151
|
+
f"--use-{provider}" if provider in ["npm", "pnpm", "yarn"] else "",
|
|
152
|
+
"--no-git",
|
|
153
|
+
"--ts",
|
|
154
|
+
"--eslint",
|
|
155
|
+
"--no-tailwind",
|
|
156
|
+
"--src-dir",
|
|
157
|
+
"--app",
|
|
158
|
+
"--import-alias",
|
|
159
|
+
"@/*",
|
|
160
|
+
]
|
|
161
|
+
# Remove empty strings if any
|
|
162
|
+
cmd = [c for c in cmd if c]
|
|
163
|
+
|
|
164
|
+
# log output while keeping progress bar alive
|
|
165
|
+
run_command_with_output(cmd, cwd=str(target), shell=False)
|
|
166
|
+
|
|
167
|
+
progress.update(task, description="Configuring Next.js...", completed=40)
|
|
168
|
+
# Configure Next.js for static export
|
|
169
|
+
# Configure Next.js for static export
|
|
170
|
+
next_config_path = target / "frontend" / "next.config.mjs"
|
|
171
|
+
if not next_config_path.exists():
|
|
172
|
+
next_config_path = target / "frontend" / "next.config.js"
|
|
173
|
+
|
|
174
|
+
# Force overwrite with known good config for Pytron
|
|
175
|
+
next_conf_content = """/** @type {import('next').NextConfig} */
|
|
176
|
+
const nextConfig = {
|
|
177
|
+
output: 'export',
|
|
178
|
+
images: { unoptimized: true },
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export default nextConfig;
|
|
182
|
+
"""
|
|
183
|
+
next_config_path.write_text(next_conf_content, encoding="utf-8")
|
|
184
|
+
log(
|
|
185
|
+
"Configured Next.js for static export (forced overwrite)",
|
|
186
|
+
style="success",
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Add browserslist to package.json for better compatibility
|
|
190
|
+
package_json_path = target / "frontend" / "package.json"
|
|
191
|
+
if package_json_path.exists():
|
|
192
|
+
try:
|
|
193
|
+
pkg_data = json.loads(package_json_path.read_text())
|
|
194
|
+
pkg_data["browserslist"] = [
|
|
195
|
+
">0.2%",
|
|
196
|
+
"not dead",
|
|
197
|
+
"not op_mini all",
|
|
198
|
+
"not IE 11",
|
|
199
|
+
]
|
|
200
|
+
package_json_path.write_text(json.dumps(pkg_data, indent=2))
|
|
201
|
+
log("Added browserslist to package.json", style="success")
|
|
202
|
+
except Exception:
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
except subprocess.CalledProcessError as e:
|
|
206
|
+
log(f"Failed to initialize Next.js app: {e}", style="error")
|
|
207
|
+
progress.stop() # Ensure stopped if error
|
|
208
|
+
|
|
209
|
+
else:
|
|
210
|
+
# Initialize Vite app in frontend folder
|
|
211
|
+
log(f"Initializing Vite {args.template} app...", style="info")
|
|
212
|
+
progress.update(
|
|
213
|
+
task, description=f"Creating Vite {args.template} App...", completed=10
|
|
214
|
+
)
|
|
215
|
+
# Using npx to create vite app non-interactively
|
|
216
|
+
# We use a specific version (5.5.0) to avoid experimental prompts (like rolldown)
|
|
217
|
+
# that appear in newer versions (v6+).
|
|
218
|
+
try:
|
|
219
|
+
runner = get_frontend_runner(provider)
|
|
220
|
+
# Resolve full path for Windows compatibility
|
|
221
|
+
runner_path = shutil.which(runner)
|
|
222
|
+
if runner_path:
|
|
223
|
+
runner = runner_path
|
|
224
|
+
|
|
225
|
+
ret = run_command_with_output(
|
|
226
|
+
[
|
|
227
|
+
runner,
|
|
228
|
+
"-y",
|
|
229
|
+
"create-vite@5.5.0",
|
|
230
|
+
"frontend",
|
|
231
|
+
"--template",
|
|
232
|
+
args.template,
|
|
233
|
+
],
|
|
234
|
+
cwd=str(target),
|
|
235
|
+
shell=False,
|
|
236
|
+
)
|
|
237
|
+
if ret != 0:
|
|
238
|
+
raise subprocess.CalledProcessError(ret, "create-vite")
|
|
239
|
+
|
|
240
|
+
# Update package.json first with all needed dependencies and config
|
|
241
|
+
log("Configuring package.json dependencies...", style="dim")
|
|
242
|
+
package_json_path = target / "frontend" / "package.json"
|
|
243
|
+
if package_json_path.exists():
|
|
244
|
+
try:
|
|
245
|
+
pkg_data = json.loads(package_json_path.read_text())
|
|
246
|
+
|
|
247
|
+
# Ensure sections exist
|
|
248
|
+
if "dependencies" not in pkg_data:
|
|
249
|
+
pkg_data["dependencies"] = {}
|
|
250
|
+
if "devDependencies" not in pkg_data:
|
|
251
|
+
pkg_data["devDependencies"] = {}
|
|
252
|
+
|
|
253
|
+
# Add pytron-client
|
|
254
|
+
pkg_data["dependencies"]["pytron-client"] = "^0.1.8"
|
|
255
|
+
|
|
256
|
+
# Add legacy polyfills
|
|
257
|
+
pkg_data["devDependencies"]["@vitejs/plugin-legacy"] = "^5.4.1"
|
|
258
|
+
pkg_data["devDependencies"]["terser"] = "^5.31.1"
|
|
259
|
+
|
|
260
|
+
# Add browserslist
|
|
261
|
+
pkg_data["browserslist"] = [
|
|
262
|
+
">0.2%",
|
|
263
|
+
"not dead",
|
|
264
|
+
"not op_mini all",
|
|
265
|
+
"not IE 11",
|
|
266
|
+
]
|
|
267
|
+
|
|
268
|
+
package_json_path.write_text(json.dumps(pkg_data, indent=2))
|
|
269
|
+
log(
|
|
270
|
+
"Updated package.json with legacy polyfills and pytron-client",
|
|
271
|
+
style="success",
|
|
272
|
+
)
|
|
273
|
+
except Exception as e:
|
|
274
|
+
log(f"Warning: Failed to update package.json: {e}", style="warning")
|
|
275
|
+
|
|
276
|
+
# Install ALL dependencies in one go
|
|
277
|
+
log("Installing dependencies...", style="dim")
|
|
278
|
+
progress.update(
|
|
279
|
+
task, description="Installing Dependencies...", completed=40
|
|
280
|
+
)
|
|
281
|
+
# Resolve full path for Windows compatibility
|
|
282
|
+
provider_path = shutil.which(provider)
|
|
283
|
+
if provider_path:
|
|
284
|
+
provider_cmd = provider_path
|
|
285
|
+
else:
|
|
286
|
+
provider_cmd = provider
|
|
287
|
+
|
|
288
|
+
ret = run_command_with_output(
|
|
289
|
+
[provider_cmd, "install"],
|
|
290
|
+
cwd=str(target / "frontend"),
|
|
291
|
+
shell=False,
|
|
292
|
+
)
|
|
293
|
+
if ret != 0:
|
|
294
|
+
log(
|
|
295
|
+
f"Warning: {provider} install failed. You may need to run '{provider} install' manually in the frontend folder.",
|
|
296
|
+
style="warning",
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
# Configure Vite for relative paths (base: './') and legacy polyfills
|
|
300
|
+
# We FORCE overwrite the config to ensure stability, rather than patching.
|
|
301
|
+
vite_config_path = target / "frontend" / "vite.config.js"
|
|
302
|
+
if (target / "frontend" / "vite.config.ts").exists():
|
|
303
|
+
vite_config_path = target / "frontend" / "vite.config.ts"
|
|
304
|
+
|
|
305
|
+
# Detect framework plugin based on template arg to ensure we don't break HMR
|
|
306
|
+
framework_plugin_import = ""
|
|
307
|
+
framework_plugin_usage = ""
|
|
308
|
+
|
|
309
|
+
if "react" in args.template:
|
|
310
|
+
framework_plugin_import = "import react from '@vitejs/plugin-react'"
|
|
311
|
+
framework_plugin_usage = "react(),"
|
|
312
|
+
elif "vue" in args.template:
|
|
313
|
+
framework_plugin_import = "import vue from '@vitejs/plugin-vue'"
|
|
314
|
+
framework_plugin_usage = "vue(),"
|
|
315
|
+
elif "svelte" in args.template:
|
|
316
|
+
framework_plugin_import = (
|
|
317
|
+
"import { svelte } from '@sveltejs/vite-plugin-svelte'"
|
|
318
|
+
)
|
|
319
|
+
framework_plugin_usage = "svelte(),"
|
|
320
|
+
|
|
321
|
+
vite_conf_content = f"""
|
|
322
|
+
import {{ defineConfig }} from 'vite'
|
|
323
|
+
import legacy from '@vitejs/plugin-legacy'
|
|
324
|
+
import {{ resolve }} from 'path'
|
|
325
|
+
|
|
326
|
+
{framework_plugin_import}
|
|
327
|
+
|
|
328
|
+
// Pytron Enforced Config ({args.template})
|
|
329
|
+
export default defineConfig({{
|
|
330
|
+
base: './', // Critical for file:// protocol
|
|
331
|
+
plugins: [
|
|
332
|
+
{framework_plugin_usage}
|
|
333
|
+
legacy({{
|
|
334
|
+
targets: ['defaults', 'not IE 11'],
|
|
335
|
+
}}),
|
|
336
|
+
],
|
|
337
|
+
resolve: {{
|
|
338
|
+
alias: {{
|
|
339
|
+
'@': resolve(__dirname, './src'),
|
|
340
|
+
}},
|
|
341
|
+
}},
|
|
342
|
+
}})
|
|
343
|
+
"""
|
|
344
|
+
vite_config_path.write_text(vite_conf_content, encoding="utf-8")
|
|
345
|
+
log(
|
|
346
|
+
"Configured Vite for relative paths and legacy polyfills (forced overwrite)",
|
|
347
|
+
style="success",
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
# --- INJECT STARTER CODE ---
|
|
351
|
+
if "react" in args.template:
|
|
352
|
+
app_jsx = target / "frontend" / "src" / "App.jsx"
|
|
353
|
+
if not app_jsx.exists():
|
|
354
|
+
app_jsx = target / "frontend" / "src" / "App.tsx"
|
|
355
|
+
|
|
356
|
+
if app_jsx.exists():
|
|
357
|
+
app_jsx.write_text("""import { useState } from 'react'
|
|
358
|
+
import pytron from 'pytron-client'
|
|
359
|
+
import './App.css'
|
|
360
|
+
|
|
361
|
+
function App() {
|
|
362
|
+
const [msg, setMsg] = useState("Click to greet Python ")
|
|
363
|
+
|
|
364
|
+
const handleGreet = async () => {
|
|
365
|
+
try {
|
|
366
|
+
const response = await pytron.greet("React Developer")
|
|
367
|
+
setMsg(response)
|
|
368
|
+
} catch (err) {
|
|
369
|
+
console.error(err)
|
|
370
|
+
setMsg("Error: Check console (Is Python running?)")
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return (
|
|
375
|
+
<div style={{ textAlign: "center", marginTop: "50px", fontFamily: "system-ui" }}>
|
|
376
|
+
<h1> Pytron + React</h1>
|
|
377
|
+
<p style={{ fontSize: "1.2rem", color: "#666" }}>{msg}</p>
|
|
378
|
+
<button
|
|
379
|
+
onClick={handleGreet}
|
|
380
|
+
style={{ padding: "10px 20px", fontSize: "1rem", cursor: "pointer" }}
|
|
381
|
+
>
|
|
382
|
+
Call Backend
|
|
383
|
+
</button>
|
|
384
|
+
</div>
|
|
385
|
+
)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export default App
|
|
389
|
+
""")
|
|
390
|
+
log(
|
|
391
|
+
"Injected React starter code with Pytron Client",
|
|
392
|
+
style="success",
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
elif "vue" in args.template:
|
|
396
|
+
app_vue = target / "frontend" / "src" / "App.vue"
|
|
397
|
+
if app_vue.exists():
|
|
398
|
+
app_vue.write_text("""<script setup>
|
|
399
|
+
import { ref } from 'vue'
|
|
400
|
+
import pytron from 'pytron-client'
|
|
401
|
+
|
|
402
|
+
const msg = ref("Click to greet Python ")
|
|
403
|
+
|
|
404
|
+
async function greet() {
|
|
405
|
+
try {
|
|
406
|
+
msg.value = await pytron.greet("Vue Developer")
|
|
407
|
+
} catch (err) {
|
|
408
|
+
console.error(err)
|
|
409
|
+
msg.value = "Error: " + err
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
</script>
|
|
413
|
+
|
|
414
|
+
<template>
|
|
415
|
+
<div class="container">
|
|
416
|
+
<h1>Pytron + Vue</h1>
|
|
417
|
+
<p class="msg">{{ msg }}</p>
|
|
418
|
+
<button @click="greet">Call Backend</button>
|
|
419
|
+
</div>
|
|
420
|
+
</template>
|
|
421
|
+
|
|
422
|
+
<style scoped>
|
|
423
|
+
.container {
|
|
424
|
+
text-align: center;
|
|
425
|
+
margin-top: 50px;
|
|
426
|
+
font-family: system-ui;
|
|
427
|
+
}
|
|
428
|
+
.msg {
|
|
429
|
+
font-size: 1.2rem;
|
|
430
|
+
color: #666;
|
|
431
|
+
}
|
|
432
|
+
button {
|
|
433
|
+
padding: 10px 20px;
|
|
434
|
+
font-size: 1rem;
|
|
435
|
+
cursor: pointer;
|
|
436
|
+
}
|
|
437
|
+
</style>
|
|
438
|
+
""")
|
|
439
|
+
log("Injected Vue starter code with Pytron Client", style="success")
|
|
440
|
+
|
|
441
|
+
except subprocess.CalledProcessError as e:
|
|
442
|
+
log(f"Failed to initialize Vite app: {e}", style="error")
|
|
443
|
+
# Fallback to creating directory if failed
|
|
444
|
+
frontend = target / "frontend"
|
|
445
|
+
if not frontend.exists():
|
|
446
|
+
frontend.mkdir()
|
|
447
|
+
(frontend / "index.html").write_text(
|
|
448
|
+
f"<!doctype html><html><body><h1>Pytron App ({args.template} Init Failed)</h1></body></html>"
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
# Create README
|
|
452
|
+
(target / "README.md").write_text(
|
|
453
|
+
f"# My Pytron App\n\nBuilt with Pytron CLI init template ({args.template}).\n\n## Structure\n- `app.py`: Main Python entrypoint\n- `settings.json`: Application configuration\n- `frontend/`: {args.template} Frontend"
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
# Create virtual environment
|
|
457
|
+
log("Creating virtual environment...", style="info")
|
|
458
|
+
progress.update(task, description="Creating Virtual Environment...", completed=70)
|
|
459
|
+
env_dir = target / "env"
|
|
460
|
+
try:
|
|
461
|
+
run_command_with_output([sys.executable, "-m", "venv", str(env_dir)])
|
|
462
|
+
|
|
463
|
+
# Determine pip path in new env
|
|
464
|
+
if sys.platform == "win32":
|
|
465
|
+
pip_exe = env_dir / "Scripts" / "pip"
|
|
466
|
+
else:
|
|
467
|
+
pip_exe = env_dir / "bin" / "pip"
|
|
468
|
+
|
|
469
|
+
log("Installing dependencies in virtual environment...", style="dim")
|
|
470
|
+
progress.update(
|
|
471
|
+
task, description="Installing Python Dependencies...", completed=90
|
|
472
|
+
)
|
|
473
|
+
# Install pytron in the new env.
|
|
474
|
+
run_command_with_output([str(pip_exe), "install", "pytron-kit"])
|
|
475
|
+
|
|
476
|
+
# Create requirements.json
|
|
477
|
+
req_data = {"dependencies": ["pytron-kit"]}
|
|
478
|
+
(target / "requirements.json").write_text(json.dumps(req_data, indent=4))
|
|
479
|
+
|
|
480
|
+
# Create helper run scripts
|
|
481
|
+
if sys.platform == "win32":
|
|
482
|
+
run_script = target / "run.bat"
|
|
483
|
+
run_script.write_text(
|
|
484
|
+
"@echo off\ncall env\\Scripts\\activate.bat\npython app.py\npause"
|
|
485
|
+
)
|
|
486
|
+
else:
|
|
487
|
+
run_script = target / "run.sh"
|
|
488
|
+
run_script.write_text(
|
|
489
|
+
"#!/bin/bash\nsource env/bin/activate\npython app.py", encoding="utf-8"
|
|
490
|
+
)
|
|
491
|
+
# Make it executable
|
|
492
|
+
try:
|
|
493
|
+
run_script.chmod(run_script.stat().st_mode | 0o111)
|
|
494
|
+
except Exception:
|
|
495
|
+
pass
|
|
496
|
+
|
|
497
|
+
except Exception as e:
|
|
498
|
+
log(f"Warning: Failed to set up virtual environment: {e}", style="warning")
|
|
499
|
+
|
|
500
|
+
progress.update(task, description="Done!", completed=100)
|
|
501
|
+
progress.stop()
|
|
502
|
+
|
|
503
|
+
log("Scaffolded app files:", style="success")
|
|
504
|
+
console.print(f" - {app_file}", style="dim")
|
|
505
|
+
console.print(f" - {settings_file}", style="dim")
|
|
506
|
+
console.print(f" - {target}/frontend", style="dim")
|
|
507
|
+
|
|
508
|
+
# Do not print absolute env paths or activation commands here. Printing
|
|
509
|
+
# explicit env activation instructions can lead users to activate the
|
|
510
|
+
# environment and then run `pytron run` from inside the venv which may
|
|
511
|
+
# confuse the CLI env resolution. Provide a concise, platform-agnostic
|
|
512
|
+
# message instead.
|
|
513
|
+
print_rule("Initialization Complete", style="bold green")
|
|
514
|
+
console.print(
|
|
515
|
+
"A virtual environment was created at: [bold]env/[/bold] (project root)."
|
|
516
|
+
)
|
|
517
|
+
console.print("Install dependencies: [bold cyan]pytron install[/bold cyan]")
|
|
518
|
+
console.print(
|
|
519
|
+
"Run the app via the CLI: [bold cyan]pytron run[/bold cyan] (the CLI will prefer env/ when present)"
|
|
520
|
+
)
|
|
521
|
+
return 0
|