DEV Community

Hiroshi Sasaki
Hiroshi Sasaki

Posted on

I Wrote a Python-to-Rust Transpiler in Python… Then Transpiled Itself to Rust

SlimePython — A deterministic Python → Rust transpiler that converted itself.


The Bootstrapping Story

The funniest part?

SlimePython was originally written in Python.

Then, using SlimePython itself, I transpiled its own codebase into Rust.

It worked perfectly. The output passed SHA-256 verification — bit-exact match.


What is SlimePython?

SlimePython is a structural transpiler that converts statically-typed Python into clean, high-performance Rust code with strong correctness guarantees.

Core Features

  • Bit-exact conversion: Same input produces mathematically identical output
  • SHA-256 verification built-in to prove correctness
  • Fully deterministic (no LLM, no randomness)
  • Focuses on preserving semantic structure
  • Excellent for numerical computing, AI/ML, and performance-critical code

Why This Matters

In production systems where numerical stability is critical (finance, scientific computing, AI inference, simulations), even tiny floating-point drifts or logic differences can be unacceptable.

SlimePython aims to solve the “it works in Python but behaves differently in Rust” problem.


Current Distribution

  • Free for Personal & Non-commercial Use: WASM CLI version
  • Download directly from the official website
  • Enterprise version: Native CLI, GUI, unlimited usage, priority support

Official Page:

https://www.javatel.co.jp/products/slimenenc/slimepython/


Who is it for?

  • Python engineers who want Rust-level performance and safety
  • Teams modernizing legacy Python or Mainframe systems
  • Developers working on numerical or ML codebases
  • Anyone who values reproducibility and trust in generated code

Final Thoughts

While it won’t convert every dynamic Python script perfectly yet, for well-typed algorithmic and numerical code, SlimePython is one of the most serious attempts at trustworthy Python-to-Rust migration available today.

And yes — eating its own source code and surviving the conversion is a pretty solid flex.


Tags:

Rust #Python #Transpiler #PythonToRust #WebAssembly #Performance #BitExact #MainframeModernization

Top comments (0)