py2many: Universal Python Transpiler to Rust, C++, Go, and More

This repository profile is provided by osrepos.com, an open source repository discovery platform.

py2many: Universal Python Transpiler to Rust, C++, Go, and More

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.

Repository Information

Analyzed by OSRepos on March 17, 2026

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

py2many 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.

Key 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.

Installation

To get started with py2many, you'll need Python 3.8+ installed.

Install via pip:

pip3 install --user py2many # installs to $HOME/.local

OR

sudo pip3 install py2many # installs systemwide

Examples

See how py2many converts Python code to idiomatic Rust:

Original Python code:

def fib(i: int) -> int:
    if i == 0 or i == 1:
        return 1
    return fib(i - 1) + fib(i - 2)

# Demonstrate overflow handling
def add(i: i32, j: i32):
    return i + j

Transpiled Rust code:

fn fib(i: i32) -> i32 {
    if i == 0 || i == 1 {
        return 1;
    }
    return (fib((i - 1)) + fib((i - 2)));
}

// return type is i64
pub fn add(i: i32, j: i32) -> i64 {
    return ((i as i64) + (j as i64)) as i64;
}

To transpile your Python code to different languages, use the py2many command with the desired target language flag:

# Python to Rust
py2many --rust tests/cases/fib.py

# Python to C++
py2many --cpp tests/cases/fib.py

# Python to Go
py2many --go tests/cases/fib.py

You can find more transpiled examples for all supported languages in the official repository's tests/expected directory: More Examples.

Why Use py2many

py2many offers several compelling reasons for its adoption:

  • Performance: Dramatically improve execution speed by transpiling Python to languages like Rust, C++, or Go, while retaining Python's development ease.
  • Security: Write security-sensitive code in Python, verify it, then transpile to safer systems languages like Rust to mitigate common vulnerabilities.
  • Cross-platform Development: Accelerate Python code by converting it into native extensions or standalone applications for various platforms.
  • Mobile & Systems Programming: Develop once in Python and deploy to multiple targets, offering an alternative to platform-specific solutions.
  • Learning Tool: An excellent resource for learning new programming languages by comparing Python implementations with their transpiled counterparts.

Links

For more information, examples, and to contribute to the project, please visit the official resources:

Related repositories

Similar repositories that may be relevant next.

MarkLLM: An Open-Source Toolkit for LLM Watermarking

MarkLLM: An Open-Source Toolkit for LLM Watermarking

June 23, 2026

MarkLLM is an open-source toolkit designed to simplify the research and application of watermarking technologies for large language models (LLMs). It offers a unified framework for implementing various watermarking algorithms, alongside robust visualization and comprehensive evaluation tools. This toolkit helps researchers and the broader community understand and assess the authenticity and origin of machine-generated text.

large-language-modelsllmsafety
Agent-Reach: Empower Your AI Agents with Internet Access, Zero API Fees

Agent-Reach: Empower Your AI Agents with Internet Access, Zero API Fees

June 21, 2026

Agent-Reach is a powerful GitHub repository that equips AI agents with the ability to access and search the entire internet, including platforms like Twitter, Reddit, YouTube, and Bilibili. It provides a streamlined CLI experience, eliminating the need for complex API configurations and associated fees. This project ensures your AI agent can "see" and interact with web content effortlessly.

ai-agentagent-infrastructureai-search
REAL Video Enhancer: AI-Powered Video Interpolation, Upscaling, and Denoising

REAL Video Enhancer: AI-Powered Video Interpolation, Upscaling, and Denoising

June 19, 2026

REAL Video Enhancer is a powerful open-source application designed to enhance video quality across Linux, Windows, and macOS. It leverages AI models for advanced video processing tasks such as frame interpolation, upscaling, decompression, and denoising. This tool provides a modern alternative to older software, making high-quality video enhancement accessible to a wider audience.

video-enhancementaiupscaling
NVIDIA PhysicsNeMo: Deep Learning Framework for Physics-ML Models

NVIDIA PhysicsNeMo: Deep Learning Framework for Physics-ML Models

June 16, 2026

NVIDIA PhysicsNeMo is an open-source deep learning framework designed for building, training, and fine-tuning Physics AI models. It leverages state-of-the-art scientific machine learning methods, enabling real-time predictions by combining physics knowledge with data. This framework provides scalable, GPU-optimized tools for AI4Science and engineering applications.

deep-learningmachine-learningphysics-ml

Source repository

Open the original repository on GitHub.

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️