The Python-Powered Fullstack Language
Project description
PyReact ๐
The Python-Powered Fullstack Language โ v1.2.0
Build beautiful AI-powered fullstack applications using a single language, a single file, and a single workflow.
PyReact = Python Simplicity + React Power + AI Native Development
Quick Start
# Install
pip install -e .
# Create new project
pyreact new myapp
# Start dev servers
cd myapp
pyreact dev
One File. Full Stack.
server {
def forecast(data):
return {"result": [1, 4, 9, 16]}
}
pages {
Home = "/"
Dashboard = "/dashboard" [guard]
Login = "/login"
}
component Dashboard():
result, setResult = use_state(None)
def runForecast():
data = server.forecast([])
setResult(data)
return (
<UI.Page>
<UI.Navbar title="PyReact App" />
<UI.Button onClick={runForecast}>Run Forecast</UI.Button>
<UI.Chart type="line" data={result} />
</UI.Page>
)
style {
primary = "#6366f1"
radius = "16px"
}
Dikompilasi menjadi:
- โ Flask backend dengan auto-generated REST endpoints
- โ React frontend + Tailwind CSS + react-router-dom v6
- โ
PyBridgeโข RPC โ zero
fetch()/ axios boilerplate - โ
File-System Routing โ pages block & folder
pages/ - โ Vite production build
CLI Commands
| Command | Description |
|---|---|
pyreact new <name> |
Create a new project |
pyreact dev |
Start Flask + Vite dev servers |
pyreact dev --heal |
Dev mode + AI self-healing |
pyreact build |
Build for production |
pyreact compile [file] |
Compile โ Flask + React source |
pyreact compile [file] --heal |
Compile + AI auto-heal error |
pyreact compile [file] --heal --model codellama |
Pilih model Ollama |
pyreact serve |
Serve production via Gunicorn/Waitress |
pyreact generate component <Name> |
Scaffold a component |
pyreact ai "<prompt>" |
Generate kode dengan AI lokal (gratis) |
pyreact install <package> |
Install dari PPR Registry |
pyreact hub |
Lihat Hub Marketplace templates |
pyreact test |
Run backend + frontend tests |
Fase 15: Self-Healing Compiler ๐ฉบ
Ketika terjadi syntax error, PyReact bisa memperbaikinya secara otomatis via Ollama:
pyreact compile app.pyreact --heal
+==================================================+
| PyReact Self-Healing Compiler [Fase 15] |
+==================================================+
[ERROR] Kompilasi gagal: Expected IDENTIFIER, got LBRACE '{'
[HEAL] Model terpilih: gemma4:31b-cloud
[HEAL] Mengirim ke Ollama (Percobaan 1/3)...
[HEAL] Self-Healing BERHASIL pada percobaan ke-1!
[HEAL] Perubahan:
- component {
+ component MyComponent():
Fitur:
- Auto-detect model Ollama terbaik (codellama โ qwen2.5-coder โ gemma4 โ llama3)
- Iterative retry hingga 3x
- Diff viewer + backup otomatis
- Rule-based fallback jika Ollama offline
Fase 16: File-System Routing ๐บ๏ธ
Pages Block (Explicit)
pages {
Home = "/"
About = "/about"
Blog = "/blog"
Dashboard = "/dashboard" [guard] # Protected route
Settings = "/settings" [guard, layout=App] # Guard + Layout
Login = "/login"
}
File-System Routing (Next.js Style)
pages/
index.pyreact โ /
about.pyreact โ /about
blog/index.pyreact โ /blog
blog/[slug].pyreact โ /blog/:slug (dynamic)
user/[id].pyreact โ /user/:id (dynamic)
404.pyreact โ * (Not Found)
Output App.jsx:
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/dashboard" element={<RequireAuth><Dashboard /></RequireAuth>} />
<Route path="/blog/:slug" element={<BlogSlug />} />
<Route path="*" element={<NotFound />} />
</Routes>
</BrowserRouter>
Built-in UI Components (30+)
UI.Page UI.Navbar UI.Sidebar UI.Card
UI.Button UI.Input UI.TextArea UI.Select
UI.Table UI.DataGrid UI.Chart UI.MetricCard
UI.Alert UI.Toast UI.Modal UI.Spinner
UI.Badge UI.Tabs UI.Dropdown UI.Accordion
UI.Calendar UI.Upload UI.Chatbot UI.Heading
UI.Text UI.Divider UI.Link UI.NavLink
UI.useAuth()
Compiler Architecture
app.pyreact
โ
โผ
Lexer โ Parser โ AST โ CodeGenerator
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
Flask React Router
backend frontend (react-router-dom v6)
Fase 15 โ Self-Healing: compiler/healer.py
Fase 16 โ Routing Engine: compiler/router.py
Output Structure
dist/
โโโ backend/
โ โโโ app.py โ Flask application
โ โโโ routes.py โ Auto-generated endpoints
โ โโโ generated_api.py โ server {} Python code
โ โโโ requirements.txt
โโโ frontend/
โโโ package.json โ Includes react-router-dom
โโโ src/
โโโ App.jsx โ BrowserRouter + Routes
โโโ pybridge.js โ PyBridgeโข RPC client
โโโ _routes.txt โ Router manifest
โโโ ui/
โโโ components.jsx
Demo
# Demo routing lengkap (Fase 16)
pyreact compile demo_routing.pyreact --out dist_routing
# Test self-healing (Fase 15) โ butuh Ollama berjalan
pyreact compile broken_demo.pyreact --heal
Roadmap
| Fase | Fitur | Status |
|---|---|---|
| 1โ14 | Compiler, PyBridge, UI, Database, AI Agents, PPR | โ Done |
| 15 | Self-Healing Compiler (Ollama) | โ Done |
| 16 | File-System Routing & Pages Block | โ Done |
| 17 | Type System & Validasi | ๐ฒ Planned |
| 18 | Real-Time & WebSocket | ๐ฒ Planned |
| 19 | Testing Framework | ๐ฒ Planned |
| 20 | VSCode Extension | ๐ฒ Planned |
| 21 | PyReact Cloud | ๐ฒ Planned |
License
MIT ยฉ Yuda Hasibuan
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyreact_fullstack_framework-0.1.0.tar.gz.
File metadata
- Download URL: pyreact_fullstack_framework-0.1.0.tar.gz
- Upload date:
- Size: 96.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e947e0e5b07ffce60edce3ce6172ee57f5e297b30da8142d11d90c73fe9031e8
|
|
| MD5 |
513a206cd1207f5d229513c7d470d80f
|
|
| BLAKE2b-256 |
ea20be852641d660121221a97bce0722098a803a926ebbf28b3911f822ed8b54
|
File details
Details for the file pyreact_fullstack_framework-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyreact_fullstack_framework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 91.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e92fb6a621073213a862d37c98dbf958615b93e39b411d0724cd99f5fa4f17c
|
|
| MD5 |
8847442c95886de70dd61bd0b858277d
|
|
| BLAKE2b-256 |
db2a27c6665f6bf8a75ed0dda4d7e2ee939a4e4aea7590a761bf34551b8fc19f
|