SkillAgentSearch skills...

Pytra

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

Install / Use

/learn @yaneurao/Pytra

README

<a href="docs/ja/README.md"> <img alt="日本語で読む" src="https://img.shields.io/badge/README-日本語-DC2626?style=flat-square"> </a> <p align="center"> <img src="docs/images/pytra-code-alchemist-s.png" alt="Pytra Code Alchemist" width="256"> </p> <div align="center"> <h1>Pytra</h1> <img alt="Python" src="https://img.shields.io/badge/-Python-3776AB?style=flat-square&logo=python&logoColor=white"> is Pytra's input language — Pytra transpiles that code into multiple target languages. </div> <div align="center"> <br><code>· Supported Backends ·</code><br><br> <img alt="C++" src="https://img.shields.io/badge/-C%2B%2B%C2%A0%C2%A0%C2%A0-00599C?style=flat-square&logo=cplusplus&logoColor=white"> <img alt="Rust" src="https://img.shields.io/badge/-Rust%C2%A0%C2%A0-F6B73C?style=flat-square&logo=rust&logoColor=black"> <img alt="C#" src="https://img.shields.io/badge/-C%23%C2%A0%C2%A0%C2%A0%C2%A0-239120?style=flat-square&logo=dotnet&logoColor=white"> <img alt="PowerShell" src="https://img.shields.io/badge/-PowerShell-5391FE?style=flat-square&logo=powershell&logoColor=white"> <img alt="JS" src="https://img.shields.io/badge/-JS%C2%A0%C2%A0%C2%A0%C2%A0-F7DF1E?style=flat-square&logo=javascript&logoColor=black"> <img alt="TS" src="https://img.shields.io/badge/-TS%C2%A0%C2%A0%C2%A0%C2%A0-3178C6?style=flat-square&logo=typescript&logoColor=white"> <img alt="Dart" src="https://img.shields.io/badge/-Dart%C2%A0%C2%A0-00BFA6?style=flat-square&logo=dart&logoColor=white"> <img alt="Go" src="https://img.shields.io/badge/-Go%C2%A0%C2%A0%C2%A0%C2%A0-00ADD8?style=flat-square&logo=go&logoColor=white"> <br> <img alt="Java" src="https://img.shields.io/badge/-Java%C2%A0%C2%A0-ED8B00?style=flat-square&logo=openjdk&logoColor=white"> <img alt="Scala3" src="https://img.shields.io/badge/-Scala3-10B981?style=flat-square&logo=scala&logoColor=white"> <img alt="Kotlin" src="https://img.shields.io/badge/-Kotlin-7F52FF?style=flat-square&logo=kotlin&logoColor=white"> <img alt="Swift" src="https://img.shields.io/badge/-Swift%C2%A0-F05138?style=flat-square&logo=swift&logoColor=white"> <img alt="Ruby" src="https://img.shields.io/badge/-Ruby%C2%A0%C2%A0-BB1200?style=flat-square&logo=ruby&logoColor=white"> <img alt="Lua" src="https://img.shields.io/badge/-Lua%C2%A0%C2%A0%C2%A0-4C6EF5?style=flat-square&logo=lua&logoColor=white"> <img alt="PHP" src="https://img.shields.io/badge/-PHP%C2%A0%C2%A0%C2%A0-777BB4?style=flat-square&logo=php&logoColor=white"> <img alt="Nim" src="https://img.shields.io/badge/-Nim%C2%A0%C2%A0%C2%A0-37775B?style=flat-square&logo=nim&logoColor=white"> <img alt="Julia" src="https://img.shields.io/badge/-Julia-9558B2?style=flat-square&logo=julia&logoColor=white"> <img alt="Zig" src="https://img.shields.io/badge/-Zig-F7C948?style=flat-square&logo=zig&logoColor=black"> <br> </div>

Features

🐍 Python → native code in each target language

  • 🌐 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
  • 🛠 Works with existing tools like VS Code out of the box
  • 🔧 The transpiler itself is written in Python — easy to extend
  • 🔁 Self-hosting capable — can transpile itself

Performance Comparison

Execution time of sample code written in Python versus execution time of the same code after transpilation. (Unit: seconds.) The Python column is the original code; PyPy is included for reference.

|No.|Description|<img alt="Python" src="https://img.shields.io/badge/-Python-3776AB?style=flat-square&logo=python&logoColor=white">|<img alt="PyPy" src="https://img.shields.io/badge/-PyPy-4B8BBE?style=flat-square">|<img alt="C++" src="https://img.shields.io/badge/-C%2B%2B-00599C?style=flat-square&logo=cplusplus&logoColor=white">|<img alt="Rust" src="https://img.shields.io/badge/-Rust-F6B73C?style=flat-square&logo=rust&logoColor=black">|<img alt="C%23" src="https://img.shields.io/badge/-C%23-239120?style=flat-square&logo=dotnet&logoColor=white">|<img alt="JS" src="https://img.shields.io/badge/-JS-F7DF1E?style=flat-square&logo=javascript&logoColor=black">| |-|-|-:|-:|-:|-:|-:|-:| |06 |Julia set parameter sweep (GIF)|9.627|0.507|0.546|0.407|0.329|0.626| |16 |Glass sculpture chaos rotation (GIF)|6.847|0.606|0.277|0.246|1.220|0.650|

Full data for all languages and all samples → Sample page

<table><tr> <td valign="top" width="50%">

06_julia_parameter_sweep

<details> <summary>Sample code : 06_julia_parameter_sweep.py</summary> </details> <details> <summary>Transpiled code (per language)</summary>

C++ | Rust | C# | JS | TS | Dart | Go | Java | Swift | Kotlin | Ruby | Lua | Scala3 | PHP | Julia

</details> </td> <td valign="top" width="50%">

16_glass_sculpture_chaos

<details> <summary>Sample code : 16_glass_sculpture_chaos.py</summary> </details> <details> <summary>Transpiled code (per language)</summary>

C++ | Rust | C# | JS | TS | Dart | Go | Java | Swift | Kotlin | Ruby | Lua | Scala3 | PHP | Julia

</details> </td> </tr></table>

Python vs C++ vs Rust vs Pytra

Legend: ✅ = Good / 🔶 = Partial / limited / ❌ = Not supported / difficult

| Aspect | Python | C++ | Rust | Pytra | |-|-|-|-|-| | Syntax | ✅ Simple | ❌ Complex | 🔶 Ownership/<br>lifetimes | ✅ Same as Python | | Type safety | ❌ Dynamic | ✅ Static | ✅ Static | ✅ Static<br>(Python-style annotations) | | Execution speed | ❌ Slow | ✅ Fast | ✅ Fast | ✅ Fast<br>(depends on target) | | Memory management | ✅ GC<br>(easy but heavy) | ❌ Manual/<br>shared_ptr | 🔶 Ownership<br>(safe but hard) | ✅ RC-based<br>automatic | | Integer types | 🔶 Arbitrary precision only | ✅ int8–64 | ✅ i8–i64 | ✅ int8–64 | | float | 🔶 64-bit only | ✅ 32/64-bit | ✅ f32/f64 | ✅ 32/64-bit | | Build | ✅ Not needed | ❌ CMake etc. | 🔶 cargo | ✅ ./pytra<br>--build --run | | Multi-language output | ❌ | ❌ | ❌ | ✅ 18 languages | | Optimization | ❌ Limited | ✅ Rich | ✅ Rich | ✅ Leverages target | | Distribution | 🔶 Requires runtime | ✅ Binary | ✅ Binary | ✅ Language-native | | Single inheritance | ✅ | ✅ | ❌ traits only | ✅ | | Multiple inheritance | ✅ | 🔶 Complex | ❌ | ❌ | | Mix-in | ✅ | 🔶 CRTP etc. | ❌ | ✅ | | Trait/<br>Interface | 🔶 Protocol | 🔶 virtual base | ✅ Native | ✅ @trait | | Exception handling | ✅ | ✅ | ❌ Result/panic | ✅ All languages | | Templates/<br>Generics | ❌ | 🔶 Cryptic errors | ✅ | ✅ @template | | Selfhost | ❌ | ❌ | ❌ | ✅ |

<a id="read-the-docs"></a>

Read the Docs

| | English | 日本語 | |---|---|---| | Getting started | Tutorial | チュートリアル | | Guide | Guides | ガイド | | Specification | Spec index | 仕様書 | | Progress | Project Progress | プロジェクト進捗 |

Changelog

2026-04-07 — Lint down to 149 / 14 languages at 10/10 PASS (697→149). PyFile abolished, IOBase hierarchy in built_in/io.py. Emitter guide §12.7. Cross-language PyFile coupling removal. Go/Rust/C#/PHP/Ruby/Lua emitter guide alignment.

2026-04-06 — With statement via __enter__/__exit__ protocol (CommonRenderer try/finally + hoist). 2 with fixtures added. Parity FAIL keeps work dir. TS/JS shim cleanup complete. Dart emitter guide compliance. JVM major progress (Scala/Kotlin emitters). .east* removed from git.

2026-04-05 — containers.py mut[T] annotations for meta.mutates_receiver. C++ method name hardcode removed. mapping.json FQCN key unification. Toolchain rename complete.

2026-04-04 — 23 Python method name hardcode patterns in lint. All-skip parity now FAIL. callable_optional_none fixture. Emitter guide §12.6 callable mapping + §14.1 lint docs.

[Full changelog](docs/en/cha

View on GitHub
GitHub Stars269
CategoryDevelopment
Updated1h ago
Forks9

Languages

Python

Security Score

100/100

Audited on Apr 9, 2026

No findings