Getting Started with PyGo
Getting Started
Section titled “Getting Started”This guide will help you set up PyGo and build your first application.
Prerequisites
Section titled “Prerequisites”- Go 1.22+ — for the Go runtime and transpiler
- Python 3.10+ — for the Python runtime
- Python
venvmodule — 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 buildand Python stdlib only.
Installation
Section titled “Installation”Option 1: Universal Installer Script (Recommended)
Section titled “Option 1: Universal Installer Script (Recommended)”# Install from GitHub releases (Linux/macOS)curl -fsSL https://pygo.dev/install.sh | bash
# Add to PATHexport PATH="$HOME/.local/bin:$PATH"Option 2: From source (development)
Section titled “Option 2: From source (development)”git clone https://github.com/Ander-Labs/pygo.gitcd pygogo build -o pygo ./cmd/pygosudo mv pygo /usr/local/bin/Option 3: From GitHub Releases (when available)
Section titled “Option 3: From GitHub Releases (when available)”# Download the latest release (Linux)curl -L https://github.com/Ander-Labs/pygo/releases/latest/download/pygo-linux-amd64 -o /usr/local/bin/pygochmod +x /usr/local/bin/pygoNote: PyPI package (
pip install pygo-framework) is not yet available. Use source installation for now.
Verify Installation
Section titled “Verify Installation”pygo versionExpected output:
PyGo Framework v1.0.0Go runtime: go1.22+Python runtime: 3.10+Create Your First Project
Section titled “Create Your First Project”pygo new myappcd myapppygo devThis 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.mdYour First .pgo File
Section titled “Your First .pgo File”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 -> greetThen transpile and run:
# Transpile .pgo files into gen_py.py and gen_go.gopygo gen web/app.pgo
# Start development server (transpile + supervisor + HTTP server)pygo devOpen http://localhost:8080/hello/World in your browser.
CLI Commands
Section titled “CLI Commands”| 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 |
What’s Next?
Section titled “What’s Next?”- Architecture Guide — understand how PyGo works
- Core Concepts — learn the .pgo DSL
- Features Reference — explore typed DSL features