This repository contains examples demonstrating how to use px0. Each example directory showcases parallel implementations of prompt rendering across Go, TypeScript, and Python.
Each example is organized into its own folder containing individual language implementations.
01-hello-world/main.go: The Go implementation.main.ts: The TypeScript implementation.main.py: The Python implementation.
Set up the local environment and install dependencies.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
npm install
go mod downloadExecute the example code in each language directory using standard compiler and interpreter tools. Ensure your local px0 server is running, or configure the host and access token using environment variables.
Set these variables in a .env file at the root of the project. A .env.example template is provided.
cp .env.example .envThe supported environment variables are:
PX0_HOST: The URL of yourpx0API instance (defaults tohttp://localhost:8000).PX0_ACCESS_TOKEN: Your API access token.
Before executing the examples, make sure to load the environment variables into your shell:
set -a && source .env && set +aActivate the virtual environment and run the Python implementation:
python 01-hello-world/main.pyExecute the TypeScript implementation directly using ts-node:
npx ts-node 01-hello-world/main.tsRun the Go implementation:
go run 01-hello-world/main.goThis project is licensed under the MIT License. See the LICENSE file for details.