parser/src: python lexing, parsing and astvm/src: python virtual machinebuiltins.rs: Builtin functionscompile.rs: the python compiler from ast to bytecodeobj: python builtin types
src: using the other subcrates to bring rustpython to life.docs: documentation (work in progress)py_code_object: CPython bytecode to rustpython bytecode converter (work in progress)wasm: Binary crate and resources for WebAssembly buildtests: integration test snippets
The code style used is the default rustfmt codestyle. Please format your code accordingly. We also use clippy to detect rust code issues.
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 install
$ pipenv run pytest -vThere also are some unit tests, you can run those with cargo:
$ cargo test --allTo profile rustpython, simply build in release mode with the flame-it feature.
This will generate a file flamescope.json, which you can then view at
https://speedscope.app.
$ cargo run --release --features flame-it script.py
$ cat flamescope.json
{<json>}You can also pass the --output-file option to choose which file to output to
(or stdout if you specify -), and the --output-format option to choose if
you want to output in the speedscope json format (default), text, or a raw html
viewer (currently broken).