Skip to content

Commit 0159051

Browse files
committed
Updated README about WASM build
1 parent 13a9922 commit 0159051

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

README.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ At this stage RustPython only has preliminary support for web assembly. The inst
113113

114114
## Setup
115115

116-
To get started, install [wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html)
117-
and [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/). You will also need to have `npm` installed.
116+
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)
118117

119118
<!-- Using `rustup` add the compile target `wasm32-unknown-emscripten`. To do so you will need to have [rustup](https://rustup.rs/) installed.
120119
@@ -132,8 +131,6 @@ cd emsdk-portable/
132131
./emsdk activate sdk-incoming-64bit
133132
``` -->
134133

135-
136-
137134
## Build
138135

139136
Move into the `wasm` directory. This contains a custom library crate optimized for wasm build of RustPython.
@@ -142,7 +139,11 @@ Move into the `wasm` directory. This contains a custom library crate optimized f
142139
cd wasm
143140
```
144141

145-
From here run the build. This can take several minutes depending on the machine.
142+
For testing on a development server, you can run the `build.sh` script. For release build which generates files for deploying to a HTTP server, run `release.sh`.
143+
144+
If you don't want to use the above scripts, you can do it manually as follows:
145+
146+
Run the build. This can take several minutes depending on the machine.
146147

147148
```
148149
wasm-pack build
@@ -169,19 +170,7 @@ and you will be able to run the files with:
169170
node_modules/.bin/webpack-dev-server
170171
```
171172

172-
Open a browser console and see the output of rustpython_wasm. To verify this, modify the line in `app/index.js`
173-
174-
```js
175-
rp.run_code("print('Hello Python!')\n");
176-
```
177-
178-
To the following:
179-
180-
```js
181-
rp.run_code("assert(False)\n");
182-
```
183-
184-
and you should observe: `Execution failed` in your console output, indicating that the execution of RustPython has failed.
173+
Now open the webpage on https://localhost:8080, you'll be able to run Python code in the text box.
185174

186175
# Code style
187176

0 commit comments

Comments
 (0)