You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
As of now the standard library is under construction. You can
111
+
use a standard library by setting the RUSTPYTHONPATH environment
112
+
variable.
115
113
116
114
To do this, follow this method:
117
115
118
116
```shell
119
-
$cd~/GIT
120
-
$ git clone git@github.com:pybee/ouroboros.git
121
-
$export RUSTPYTHONPATH=~/GIT/ouroboros/ouroboros
122
-
$cd RustPython
123
-
$ cargo run -- -c'import statistics'
124
-
```
125
-
126
-
#Compiling to WebAssembly
127
-
128
-
At this stage RustPython only has preliminary support for web assembly. The instructions here are intended for developers or those wishing to run a toy example.
129
-
130
-
##Setup
131
-
132
-
To get started, install[wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) and`npm`. ([wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html) should be installed by`wasm-pack`. if not, install it yourself)
133
-
134
-
<!-- Using `rustup` add the compile target `wasm32-unknown-emscripten`. To do so you will need to have [rustup](https://rustup.rs/) installed.
135
-
136
-
```bash
137
-
rustup target add wasm32-unknown-emscripten
138
-
```
139
-
140
-
Next, install `emsdk`:
141
-
142
-
```bash
143
-
curl https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | tar -zxv
144
-
cd emsdk-portable/
145
-
./emsdk update
146
-
./emsdk install sdk-incoming-64bit
147
-
./emsdk activate sdk-incoming-64bit
148
-
```-->
149
-
150
-
##Build
151
-
152
-
Move into the`wasm` directory. This directory contains a library crate for interop
153
-
with python to rust to js and back in`wasm/lib`, the demo website found at
154
-
https://rustpython.github.io/demo in`wasm/demo`, and an example of how to use
155
-
the crate as a library in one's own JS app in`wasm/example`.
156
-
157
-
```sh
158
-
cd wasm
159
-
```
160
-
161
-
Go to the demo directory. This is the best way of seeing the changes made to either
162
-
the library or the JS demo, as the`rustpython_wasm` module is set to the global
163
-
JS variable`rp` on the website.
164
-
165
-
```sh
166
-
cd demo
117
+
$export RUSTPYTHONPATH=~/GIT/RustPython/Lib
118
+
$ cargo run -- -c'import xdrlib'
167
119
```
168
120
169
-
Now, start the webpack development server. It'll compile the crate and then
170
-
the demo app. This will likely take a long time, both the wasm-pack portion and
171
-
the webpack portion (from after it says "Your crate has been correctly compiled"),
172
-
so be patient.
173
-
174
-
```sh
175
-
npm run dev
176
-
```
121
+
You can play around
122
+
with other standard libraries for python. For example,