Skip to main content

Manual

gopy is a behavioural twin of CPython 3.14 written in Go. The interpreter parses, compiles, and runs Python source the same way CPython does. The result is the same bytecode, the same objects, the same error messages.

This manual is the user-facing slice of the site. It does not cover implementation. For that, see the CPython and gopy pillars.

What is in this manual

PageWhat it covers
Installgo install and prebuilt binaries.
Run a filegopy hello.py, exit codes, stdin scripts.
Hello, gopyThe smallest runnable program.
CLIEvery flag the binary accepts.
REPLThe interactive prompt.
EmbeddingCalling the gopy VM from Go.
StatusWhich Python features are wired today.
ParityHow gopy is held to CPython behaviour.

A 30 second tour

hello.py
def fizzbuzz(n):
for i in range(1, n + 1):
if i % 15 == 0:
print("FizzBuzz")
elif i % 3 == 0:
print("Fizz")
elif i % 5 == 0:
print("Buzz")
else:
print(i)

fizzbuzz(15)
$ gopy hello.py
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz

Pipe gopy -d hello.py to print the bytecode listing, or GOPY_TRACE_SPECIALIZER=1 gopy hello.py to watch the adaptive specializer in action.