Architecture

Pytron-kit is built on a modular architecture designed for security, high-performance IPC, and developer simplicity. It avoids the "Local Server" overhead by using a direct native bridge, which ensures zero port conflicts and a smaller security surface area.

Backend Process (Python)

IPC Bridge (Inter-Process Communication)

Frontend Process (Web Technology)

RPC Calls & Events

Bridge Interface

State Updates

Sync State

Update Signals

Pytron UI
React Components / Web Components

Pytron Client
JavaScript Bridge & State Manager

User Frontend App
React/Vite/Next.js

JSON Message Passing

Pytron Kit
Window Manager & Server

User Backend Code
@app.expose / Business Logic

The Polyglot Stack

Pytron-kit is a polyglot framework that leverages the best tools for each layer:

  • Python: The core of the framework (90%+). Handles the CLI, window management, and business logic.
  • JavaScript / TypeScript: Powers the frontend bridge (pytron-client), UI components (pytron-ui), and template scaffolding.
  • Rust: Provides the high-security "Agentic Shield" bootloader and payload encryption layer.
  • C / C++: Low-level OS integration (Win32, GTK, Cocoa), Android JNI bridge, and Nuitka-compiled machine code.
  • Kotlin / Java: Android-specific lifecycle management and native platform hooks.
  • HTML / CSS: The backbone of all user interfaces and frontend layouts.

Direct Native Communication

Most "Python-as-UI" frameworks spin up a local HTTP server (Flask/FastAPI) and talk via network ports. Pytron-kit uses a direct native bridge. This means zero latency, zero open ports, and zero firewall issues.

python
from pytron import App
app = App() 
app.run()

Encapsulated State Sync

Pytron-kit implements a reactive system. When you update data in Python, it's automatically diffed and pushed across the native bridge to the Pytron Client, which triggers a re-render in your UI.

Architecture Decisions

We explicitly chose WebView2 (Edge/Chromium) for Windows and WebKit for Mac/Linux to keep distribution sizes under 30MB, while maintaining the option to switch to a full Chrome Engine (Mojo) for applications requiring 100% rendering parity.