JediRhymeTrix
PyCrust
Python

PyCrust is a CLI tool that converts Python code to Rust using OpenAI's GPT-3.5 language model for code generation. It provides an easy-to-use interface for converting Python code to Rust code, making it easier for Python developers to leverage Rust's performance benefits.

Last updated May 12, 2026
42
Stars
2
Forks
0
Issues
0
Stars/day
Attention Score
6
Language breakdown
Python 64.6%
Dockerfile 18.1%
Shell 17.3%
โ–ธ Files click to expand
README

PyCrust ๐Ÿฅง [WIP] ๐Ÿšง

Pie-crust / Py(c)Rust

PyCrust is a command-line tool that transpiles Python code to Rust code, replacing Python libraries with equivalent Rust libraries wherever possible. It uses the OpenAI ChatGPT API to perform the transpilation.

Usage ๐Ÿš€

  • Install Docker and Docker Compose
  • Clone this repository: git clone https://github.com/JediRhymeTrix/pycrust.git
  • cd pycrust
  • Create a .env file with your ChatGPT API key: echo "API_KEY=<your-api-key>" > .env
  • Give the runner shell script the appropriate permission to run: chmod +x scripts/pycrust.sh
  • Run the Docker container and transpile your code using the command ./pycrust.sh /path/to/input.py to transpile the Python code to Rust code. The output will be saved in a file with the same name as the input file, but with the .rs extension.

Dependencies ๐Ÿ“ฆ

  • Docker
  • Docker Compose
  • OpenAI ChatGPT API key

Directory Structure ๐Ÿ“

pycrust/ โ”œโ”€โ”€ docker-compose.yml โ”œโ”€โ”€ Dockerfile โ”œโ”€โ”€ scripts/ โ”‚ โ”œโ”€โ”€ download_dependencies.sh โ”‚ โ””โ”€โ”€ pycrust.sh โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ init.py โ”‚ โ””โ”€โ”€ pycrust.py โ”œโ”€โ”€ tests/ โ”‚ โ””โ”€โ”€ test_pycrust.py โ””โ”€โ”€ requirements.txt

Notes ๐Ÿ“

  • This tool is still in development and may not work with all Python code.
  • The Rust code generated by PyCrust may require additional work to compile and run.
  • If a Rust equivalent library for a Python library does not exist, PyCrust will generate a list of missing dependencies.
๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท JediRhymeTrix/PyCrust ยท Updated daily from GitHub