Skip to main content

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

Metadata

Release files for pyreact-fullstack-framework 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyreact-fullstack-framework 0.1.0
File Size Uploaded Provenance Actions
pyreact_fullstack_framework-0.1.0.tar.gz 96.4 kB Without provenance Details for pyreact_fullstack_framework-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyreact-fullstack-framework 0.1.0
File Interpreter ABI Platform Actions
pyreact_fullstack_framework-0.1.0-py3-none-any.whl Python 3 none any Details for pyreact_fullstack_framework-0.1.0-py3-none-any.whl

Total release size: 187.5 kB

Release files / pyreact_fullstack_framework-0.1.0.tar.gz

Download URL pyreact_fullstack_framework-0.1.0.tar.gz
Size 96.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e947e0e5b07ffce60edce3ce6172ee57f5e297b30da8142d11d90c73fe9031e8
BLAKE2b-256 checksum
How to use checksums
ea20be852641d660121221a97bce0722098a803a926ebbf28b3911f822ed8b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / pyreact_fullstack_framework-0.1.0-py3-none-any.whl

Download URL pyreact_fullstack_framework-0.1.0-py3-none-any.whl
Size 91.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e92fb6a621073213a862d37c98dbf958615b93e39b411d0724cd99f5fa4f17c
BLAKE2b-256 checksum
How to use checksums
db2a27c6665f6bf8a75ed0dda4d7e2ee939a4e4aea7590a761bf34551b8fc19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for pyreact-fullstack-framework 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page