Skip to content
No description, website, or topics provided.
Python Go Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Rye is a Pythonic scripting language for the Go ecosystem. Rye translates a rigid subset of old-school Python into Go.

Why Go?

  • the Go runtime rules
  • Go libraries rule
  • Go concurrency rules

Why Python?

  • I love Single Inheritance.
  • I love exceptions.
  • I love duck typing. (Yeah, those all have their problems, but for some projects, they're the problems I choose.)


  • None, bool, int, float. (All ints are int64; there is no long. Use Go's math/big if you need big ints.)
  • str, byt. (byt corresponds to []byte in Go. It converts to/from str, but also to/from a list of int.)
  • tuple, list, dict, set. Iterators on them.
  • object (ultimate superclass of all user-defined classes).
  • Various callable things: named functions, lambda exprs, class constructors, uncalled instance methods.
  • Reflective references to Go objects (passed in and out of Go functions).


  • go fn(x, y, z, ...) is an expression, returning a promise, running in background. You can Wait() for the result.
  • Generator functions (those using yield) run in their own goroutine, when iterated in a "for" loop.
  • Go libaries (like net/http) also create goroutines, which can call back into Rye functions.

Rye Modules

  • Each source .py file defines 1 module (not each directory, as in go).


  • Import statements: - from . import stuff # where is another Rye module - from go import net/http # Go standard library - from go import # Other Go packages - import re # A small amount of python library emulation is available.


  • All ints are int64. No longs.
  • No monkey-patching.
  • No module reflection (yet).
  • Many builtins and methods on builtin types are missing.
  • No python libraries. Use go libraries.
  • No nested classes. No class methods.
  • Dictionary keys are converted to strings (as in javascript).
  • No code blocks after ":" on same line with "if", "for", etc., statements.
  • Continued lines (due to unclosed parens, etc.) should indent but not outdent.
  • Lack of meaningful error messages due to unclosed parens, etc. (Obscured by "continued line" logic.)
  • More limitations.
  • Also bugs.

Compile & Run

  • python .../rye/compiler/ build (creates a binary).
  • python .../rye/compiler/ run arg1 arg2...

Interpreter (not working any more)

  • python .../rye/ interp
  • Commands /b ; /g ; /l ; (builtins; globals; locals)
  • work in progress.


  • tests/ directory.
  • The compiler is written in rye (actually, the common subset of python and rye).
  • See also "strickyak/aphid" github for lots of Rye code.
You can’t perform that action at this time.