Skip to content
Projects

About

Ultimate transpiler: converts Python to C++, Rust, C#, PowerShell, JavaScript, TypeScript, Dart, Go, Java, Swift, Kotlin, Ruby, Lua, Scala3, PHP, Nim, Julia, and Zig.

Languages & Runtimes

How these counts are measured

What you can do

  • 🌐 Transpiles to C++ / Rust / Go / Java / TS and many more
  • 🧩 Preserves the original code structure almost entirely
  • ⚡ Write in Python, generate high-performance code
  • ✨ Simple Python subset input

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

docs/en/tutorial/README.md

Original
Read in Japanese

Tutorial

A starting point for first-time Pytra users.

Get Running in 3 Minutes

def add(a: int, b: int) -> int:
    return a + b

if __name__ == "__main__":
    print(add(3, 4))

Transpile this add.py to C++ and run it:

./pytra add.py --output-dir out/add_case --build --run --exe add.out

Output:

7

Reading Order

  1. How to use — Build steps, supported languages, main options
  2. Try the samples — Try the 18 sample programs
  3. Differences from Python — Type annotations, imports, unsupported syntax
  4. Troubleshooting — When you get stuck
  5. Exception handling — raise / try / except / finally
  6. Traits (interfaces) — Attaching multiple behavioral contracts to a type
  7. Union types and isinstance narrowing — Handling multiple types and automatic type refinement
  8. Available modules — Commonly used modules and functions
  9. Architecture — Pipeline overview and the role of each stage

Explore related projects

Loading…