yaneurao/Pytra
Tentang
Ultimate transpiler: converts Python to C++, Rust, C#, PowerShell, JavaScript, TypeScript, Dart, Go, Java, Swift, Kotlin, Ruby, Lua, Scala3, PHP, Nim, Julia, and Zig.
Bahasa pemrograman dan runtimeYang dapat Anda lakukan
- 🌐 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
Pertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
Asli
Pytra
· Supported Backends ·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 | ||||||
|---|---|---|---|---|---|---|---|
| 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
Sample code : 06_julia_parameter_sweep.py
|
Sample code : 16_glass_sculpture_chaos.py
|
Python vs C++ vs Rust vs Pytra
Legend: ✅ = Good / 🔶 = Partial / limited / ❌ = Not supported / difficult
| Aspect | ||||
|---|---|---|---|---|
| Syntax | ✅ Simple | ❌ Complex | 🔶 Ownership/ lifetimes |
✅ Same as Python |
| Type safety | ❌ Dynamic | ✅ Static | ✅ Static | ✅ Static (Python-style annotations) |
| Execution speed | ❌ Slow | ✅ Fast | ✅ Fast | ✅ Fast (depends on target) |
| Memory management | ✅ GC (easy but heavy) |
❌ Manual/ shared_ptr |
🔶 Ownership (safe but hard) |
✅ RC-based 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--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/ Interface |
🔶 Protocol | 🔶 virtual base | ✅ Native | ✅ @trait |
| Exception handling | ✅ | ✅ | ❌ Result/panic | ✅ All languages |
| Templates/ Generics |
❌ | 🔶 Cryptic errors | ✅ | ✅ @template |
| Selfhost | ❌ | ❌ | ❌ | ✅ |
Read the Docs
| Getting started | Tutorial | チュートリアル |
| Guide | Guides | ガイド |
| Specification | Spec index | 仕様書 |
| Progress | Project Progress | プロジェクト進捗 |
Changelog
2026-04-10 — P0-ZIG-CREXC-S4 complete. Zig / Rust exception / try / with handling fully shared via CommonRenderer hooks. Zig toolchain_ dependency eliminated (all languages now at 0). Nim / Go / Lua new fixture parity complete. Lua copy elision done.
2026-04-09 — Zig / Rust handler binding / panic / block expression helpers consolidated in CommonRenderer.
2026-04-08 — All languages lint clear (697→0). 18 languages at 10/10 PASS. C# / Go / Nim parity restored. Nim emitter string-split workaround eliminated. P0-ZIG-CREXC S1-S3 started.
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.
2026-04-06 — With statement via
__enter__/__exit__protocol (CommonRenderer try/finally + hoist). 2 with fixtures added. TS/JS shim cleanup complete. Dart emitter guide compliance. JVM major progress. .east* removed from git.
2026-04-05 — containers.py
mut[T]annotations formeta.mutates_receiver. C++ method name hardcode removed. mapping.json FQCN key unification. Toolchain rename complete.
License
Apache License 2.0
Jelajahi proyek terkait
Memuat…

