{"name":"py2many: Universal Python Transpiler to Rust, C++, Go, and More","description":"py2many is a powerful Python transpiler designed to convert Python source code into multiple statically-typed programming languages, including Rust, C++, Go, Julia, and Kotlin. This tool helps developers improve application performance, enhance security, and enable seamless cross-platform development. It allows users to leverage Python's ease of development while benefiting from the speed and robustness of other languages.","github":"https://github.com/py2many/py2many","url":"https://osrepos.com/repo/py2many-py2many","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/py2many-py2many","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/py2many-py2many.md","json":"https://osrepos.com/repo/py2many-py2many.json","topics":["python","transpiler","rust","golang","cpp","kotlin","code generation","development tools"],"keywords":["python","transpiler","rust","golang","cpp","kotlin","code generation","development tools"],"stars":null,"summary":"py2many is a powerful Python transpiler designed to convert Python source code into multiple statically-typed programming languages, including Rust, C++, Go, Julia, and Kotlin. This tool helps developers improve application performance, enhance security, and enable seamless cross-platform development. It allows users to leverage Python's ease of development while benefiting from the speed and robustness of other languages.","content":"## Introduction\n\npy2many is a robust Python transpiler that transforms Python source code into various statically-typed programming languages. It supports conversion to Rust, C++, Go, Zig, Julia, Nim, Dart, V, and D, with a primary focus on Python to Rust and production-ready support for C++. This tool enables developers to dramatically improve execution speed, enhance security by moving to safer systems languages, and facilitate cross-platform development.\n\nKey features include multi-language support, automatic type inference, generation of optimized code for systems programming languages, and cross-platform compatibility across Linux, macOS, and Windows. py2many also serves as an excellent educational tool for learning new languages by comparing Python implementations with their transpiled equivalents.\n\n## Installation\n\nTo get started with py2many, you'll need Python 3.8+ installed.\n\nInstall via pip:\n\nsh\npip3 install --user py2many # installs to $HOME/.local\n\n\nOR\n\nsh\nsudo pip3 install py2many # installs systemwide\n\n\n## Examples\n\nSee how py2many converts Python code to idiomatic Rust:\n\n**Original Python code:**\n\npython\ndef fib(i: int) -> int:\n    if i == 0 or i == 1:\n        return 1\n    return fib(i - 1) + fib(i - 2)\n\n# Demonstrate overflow handling\ndef add(i: i32, j: i32):\n    return i + j\n\n\n**Transpiled Rust code:**\n\nrust\nfn fib(i: i32) -> i32 {\n    if i == 0 || i == 1 {\n        return 1;\n    }\n    return (fib((i - 1)) + fib((i - 2)));\n}\n\n// return type is i64\npub fn add(i: i32, j: i32) -> i64 {\n    return ((i as i64) + (j as i64)) as i64;\n}\n\n\nTo transpile your Python code to different languages, use the `py2many` command with the desired target language flag:\n\nsh\n# Python to Rust\npy2many --rust tests/cases/fib.py\n\n# Python to C++\npy2many --cpp tests/cases/fib.py\n\n# Python to Go\npy2many --go tests/cases/fib.py\n\n\nYou can find more transpiled examples for all supported languages in the official repository's `tests/expected` directory: [More Examples](https://github.com/adsharma/py2many/tree/main/tests/expected){target=\"_blank\"}.\n\n## Why Use py2many\n\npy2many offers several compelling reasons for its adoption:\n\n*   **Performance**: Dramatically improve execution speed by transpiling Python to languages like Rust, C++, or Go, while retaining Python's development ease.\n*   **Security**: Write security-sensitive code in Python, verify it, then transpile to safer systems languages like Rust to mitigate common vulnerabilities.\n*   **Cross-platform Development**: Accelerate Python code by converting it into native extensions or standalone applications for various platforms.\n*   **Mobile & Systems Programming**: Develop once in Python and deploy to multiple targets, offering an alternative to platform-specific solutions.\n*   **Learning Tool**: An excellent resource for learning new programming languages by comparing Python implementations with their transpiled counterparts.\n\n## Links\n\nFor more information, examples, and to contribute to the project, please visit the official resources:\n\n*   [py2many GitHub Repository](https://github.com/py2many/py2many){target=\"_blank\"}\n*   [View Transpiled Examples](https://github.com/adsharma/py2many/tree/main/tests/expected){target=\"_blank\"}\n*   [Contributing Guidelines](https://github.com/adsharma/py2many/blob/main/CONTRIBUTING.md){target=\"_blank\"}","metrics":{"detailViews":5,"githubClicks":2},"dates":{"published":null,"modified":"2026-03-17T21:21:47.000Z"}}