#transpiler #verification #python #compiler

depyler-core

Core transpilation engine for the Depyler Python-to-Rust transpiler

49 stable releases (4 major)

4.1.1 Feb 15, 2026
3.24.0 Jan 30, 2026
3.20.0 Nov 12, 2025
3.19.29 Oct 29, 2025
0.3.1 Jul 7, 2025

#155 in #transpiler

35 downloads per month
Used in 9 crates

MIT/Apache

17MB
411K SLoC

Depyler Core - Transpilation Engine

Core transpilation engine for converting Python code to Rust and other targets.

Overview

This crate provides the fundamental transpilation pipeline that converts Python source code into target languages (Rust, Ruchy) while preserving semantics and ensuring memory safety.

Example

use depyler_core::DepylerPipeline;

let pipeline = DepylerPipeline::new();
let python = r#"
def factorial(n: int) -> int:
    if n <= 1:
        return 1
    return n * factorial(n - 1)
"#;

match pipeline.transpile(python) {
    Ok(rust_code) => println!("Generated:\n{}", rust_code),
    Err(e) => eprintln!("Error: {}", e),
}

Architecture

The transpilation pipeline consists of several stages:

  1. Parsing (ast_bridge) - Convert Python source to AST
  2. HIR ([hir]) - Transform AST to High-level Intermediate Representation
  3. Type Analysis (generic_inference, const_generic_inference) - Infer types and generics
  4. Ownership Analysis (borrowing, lifetime_analysis) - Determine ownership patterns
  5. Optimization (optimization, string_optimization) - Apply optimizations
  6. Code Generation (codegen, rust_gen) - Generate target code

Key Types

Dependencies

~14–32MB
~437K SLoC