forked from Rust-related/RustPython
42 lines
1.4 KiB
Markdown
42 lines
1.4 KiB
Markdown
# RustPython
|
|
|
|
A Python-3 (CPython >= 3.5.0) Interpreter written in Rust.
|
|
|
|
[](https://travis-ci.org/RustPython/RustPython)
|
|
[](https://opensource.org/licenses/MIT)
|
|
[](https://github.com/RustPython/RustPython/graphs/contributors)
|
|
[](https://gitter.im/rustpython/Lobby)
|
|
|
|
# WARNING: this project is still in a pre-alpha state!
|
|
|
|
**Using this in a production project is inadvisable. Please only do so if you understand the risks.**
|
|
|
|
## Usage
|
|
|
|
### Check out our [online demo](https://rustpython.github.io/demo/) running on WebAssembly.
|
|
|
|
## Goals
|
|
|
|
- Full Python-3 environment entirely in Rust (not CPython bindings)
|
|
- A clean implementation without compatibility hacks
|
|
|
|
## Quick Documentation
|
|
|
|
```js
|
|
pyEval(code, options?);
|
|
```
|
|
|
|
`code`: `string`: The Python code to run
|
|
|
|
`options`:
|
|
|
|
- `vars?`: `{ [key: string]: any }`: Variables passed to the VM that can be
|
|
accessed in Python with the variable `js_vars`. Functions do work, and
|
|
receive the Python kwargs as the `this` argument.
|
|
- `stdout?`: `(out: string) => void`: A function to replace the native print
|
|
function, by default `console.log`.
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT license.
|