Skip to content

Getting Started with PyGo

This guide will help you set up PyGo and build your first application.

  • Go 1.22+ — for the Go runtime and transpiler
  • Python 3.10+ — for the Python runtime
  • Python venv module — for virtual environments

Note: pnpm is NOT required for PyGo. PyGo uses Go and Python natively. The docs site uses pnpm, but the framework itself uses go build and Python stdlib only.

Section titled “Option 1: Universal Installer Script (Recommended)”
Terminal window
# Install from GitHub releases (Linux/macOS)
curl -fsSL https://pygo.dev/install.sh | bash
# Add to PATH
export PATH="$HOME/.local/bin:$PATH"
Terminal window
git clone https://github.com/Ander-Labs/pygo.git
cd pygo
go build -o pygo ./cmd/pygo
sudo mv pygo /usr/local/bin/

Option 3: From GitHub Releases (when available)

Section titled “Option 3: From GitHub Releases (when available)”
Terminal window
# Download the latest release (Linux)
curl -L https://github.com/Ander-Labs/pygo/releases/latest/download/pygo-linux-amd64 -o /usr/local/bin/pygo
chmod +x /usr/local/bin/pygo

Note: PyPI package (pip install pygo-framework) is not yet available. Use source installation for now.

Terminal window
pygo version

Expected output:

PyGo Framework v1.0.0
Go runtime: go1.22+
Python runtime: 3.10+
Terminal window
pygo new myapp
cd myapp
pygo dev

This creates a new PyGo project with the following structure:

myapp/
├── app/
│ ├── web/ # .pgo DSL files (models, handlers, routes)
│ ├── templates/ # HTML templates (HTMX)
│ ├── core/ # Python runtime modules
│ └── pygo.toml # Project configuration
├── install.sh # Python dependencies installer
└── README.md

The .pgo DSL is isomorphic to Python — same indentation, same syntax. PyGo transpiles .pgo files into:

  • gen_py.py — 1:1 Python code (identical syntax)
  • gen_go.go — Mechanical Go code (from AST visitor)

Example web/app.pgo:

enum Status:
active
inactive
pending
model User:
id: UUID
email: Email
name: String
status: Status
tags: Array[String]
metadata: Map[String]String
created: DateTime
updated: DateTime?
handler greet:
greet(name: String) -> String:
return f"Hello, {name}!"
route GET /hello/:name -> greet

Then transpile and run:

Terminal window
# Transpile .pgo files into gen_py.py and gen_go.go
pygo gen web/app.pgo
# Start development server (transpile + supervisor + HTTP server)
pygo dev

Open http://localhost:8080/hello/World in your browser.

Command Description
pygo new <name> Create a new PyGo project
pygo dev Transpile and start dev server
pygo build --embed-python Build for production with embedded Python
pygo gen [file] Transpile .pgo files
pygo test Run tests