Search

Meet RustPython, a Python written in Rust

It's Rust reinventing all possible wheels!


Meet RustPython, a Python written in Rust


With this secure memory talk the programmers Rust are reinventing all possible wheels!

Now it’s Python turn! It’s the snake falling into the crab’s mouth! 😃

Jokes aside, let’s see how to install this project!


Installation

Make sure you already have Rust and Cargo installed on your system:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

For an easier way to install, add the local ~/.cargo directory to your $PATH variable:

In this case to .bashrc

echo 'export PATH="${PATH}:${HOME}/.cargo/bin"' >> ~/.bashrc
source ~/.bashrc
execute $SHELL

Now, to install just run this command below:

cargo install --git https://github.com/RustPython/RustPython


RustPython will be automatically available in your Shell and then just test it:

rustpython --version

Test a Python script, example:

vim script.py

def terminalroot():
    var = "Hello, I'm Python written in Rust"
    print(var)

terminalroot()

And run:

rustpython script.py

Likely output: Hello, I'm Python written in Rust

You can also run it in a subshell:

user@host ~ $ rustpython
Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
>>>>> print("Running in subshell!")
Running in the subshell!
>>>>> exit()
user@host ~ $

For more information visit the RustPython repository .


rust python programming


Share



Comments