RustPython
A Python-3 (CPython >= 3.5.0) Interpreter written in Rust 🐍 😱 🤘.
Usage
To test RustPython, do the following:
$ git clone https://github.com/RustPython/RustPython
$ cd RustPython
$ cargo run demo.py
Hello, RustPython!
Or use the interactive shell:
$ cargo run
Welcome to rustpython
>>>>> 2+2
4
Goals
- Full Python-3 environment entirely in Rust (not CPython bindings)
- A clean implementation without compatibility hacks
Code organization
parser: python lexing, parsing and astvm: python virtual machinesrc: using the other subcrates to bring rustpython to life.docs: documentation (work in progress)py_code_object: CPython bytecode to rustpython bytecode convertor (work in progress)tests: integration test snippets
Contributing
To start contributing, there are a lot of things that need to be done.
Most tasks are listed in the issue tracker.
Another approach is to checkout the sourcecode, and try out rustpython until
you hit a limitation, and try to fix that. You can also simply run
cargo run tests/snippets/whats_left_to_implement.py and pickup any
unimplemented method.
Testing
To test rustpython, there is a collection of python snippets located in the
tests/snippets directory. To run those tests do the following:
$ cd tests
$ pipenv shell
$ pytest -v
There also are some unittests, you can run those will cargo:
$ cargo test --all
Code style
The code style used is the default rustfmt codestyle. Please format your code accordingly.
Community
Chat with us on gitter.
Credit
The initial work was based on windelbouwman/rspython and shinglyu/RustPython
Links
These are some useful links to related projects: