DEV Community

Cover image for From Python to Rust: Rewriting a Real Open Source Project for Port Mortem 2026
Tanya Garg
Tanya Garg

Posted on

From Python to Rust: Rewriting a Real Open Source Project for Port Mortem 2026

Modern AI can translate code between programming languages in seconds.

But one question still remains:

Does the translated program actually behave like the original?

That question is exactly what Code Resurrection 2026 – Port Mortem challenged participants to answer.

Instead of building a new application, the challenge was to take an existing open-source project and rewrite it in another language while preserving its behavior.

I participated in Track D (Python → Rust).

Why I Chose Rust

Rust has become one of the most exciting systems programming languages because it offers:

  • Memory safety without a garbage collector
  • Excellent performance
  • Strong compile-time guarantees
  • Modern tooling through Cargo
  • Reliable error handling

Rather than creating a simple syntax translation, I wanted to understand how Python concepts map to idiomatic Rust.

The Goal

The objective wasn't simply to make the project compile.

The real objective was to preserve the original behavior while redesigning the implementation using Rust best practices.

That meant focusing on:

  • Functional equivalence
  • Clean project architecture
  • Better memory safety
  • Idiomatic Rust patterns
  • Maintainability

Repository Structure

The project follows the structure recommended by the hackathon.

README.md
DECISIONS.md
Dockerfile
Cargo.toml
src/
tests/
fuzz/
bench/
.port-mortem.toml
Enter fullscreen mode Exit fullscreen mode

This organization makes the project easier to evaluate, build, and extend.

Migration Decisions

Several design choices changed during the migration.

Instead of Python's exception-based workflow, I adopted Rust's Result<T, E> error handling.

Dynamic Python collections were replaced with Rust's strongly typed collections.

The application was reorganized into Cargo modules to improve maintainability.

Every important design decision was documented in DECISIONS.md.

Biggest Challenge

The hardest part wasn't writing Rust.

It was making sure the Rust implementation behaved exactly like the original Python project.

Language features differ significantly.

Error handling, ownership, borrowing, collections, and type safety required a completely different mindset.

Writing equivalent logic often meant redesigning the implementation instead of translating it line by line.

What I Learned

This project taught me that software migration is much more than language translation.

A good migration should:

  • Preserve behavior
  • Improve maintainability
  • Follow target-language best practices
  • Be easy to build and test
  • Document architectural decisions

Rust encouraged writing code that is explicit, predictable, and easier to reason about.

Final Thoughts

Port Mortem was one of the most unique hackathons I've participated in.

Instead of rewarding quick prototypes, it encouraged participants to think like software engineers—focusing on correctness, maintainability, and engineering discipline.

Whether or not this project wins, it gave me a much deeper appreciation for systems programming, open-source software, and Rust's design philosophy.

Huge thanks to Hackathon Raptors for organizing such an interesting event.

If you're interested in systems programming or language migration, I'd definitely recommend trying a project like this yourself.

GitHub Repository: https://github.com/Tanya-garg10/croniter-.git

Top comments (0)