Skip to content

Commit 93f70ab

Browse files
Merge pull request RustPython#1108 from RustPython/update-docs
Update documentation folder and readme.
2 parents bcf470e + 5c39350 commit 93f70ab

20 files changed

+84
-1202
lines changed

README.md

+12-80
Original file line numberDiff line numberDiff line change
@@ -105,99 +105,31 @@ There also are some unit tests, you can run those with cargo:
105105
$ cargo test --all
106106
```
107107

108-
# Using another standard library
108+
# Using a standard library
109109

110-
As of now the standard library is under construction.
111-
112-
You can play around
113-
with other standard libraries for python. For example,
114-
the [ouroboros library](https://github.com/pybee/ouroboros).
110+
As of now the standard library is under construction. You can
111+
use a standard library by setting the RUSTPYTHONPATH environment
112+
variable.
115113

116114
To do this, follow this method:
117115

118116
```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'
167119
```
168120

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,
123+
the [ouroboros library](https://github.com/pybee/ouroboros).
177124

178-
You can now open the webpage on https://localhost:8080 and Python code in either
179-
the text box or browser devtools with:
180-
181-
```js
182-
rp.pyEval(
183-
`
184-
print(js_vars['a'] * 9)
185-
`,
186-
{
187-
vars: {
188-
a: 9
189-
}
190-
}
191-
);
192-
```
125+
# Compiling to WebAssembly
193126

194-
Alternatively, you can run `npm run build` to build the app once, without watching
195-
for changes, or `npm run dist` to build the app in release mode, both for the
196-
crate and webpack.
127+
[See this doc](wasm/README.md)
197128

198129
# Code style
199130

200131
The code style used is the default [rustfmt](https://github.com/rust-lang/rustfmt) codestyle. Please format your code accordingly.
132+
We also use [clippy](https://github.com/rust-lang/rust-clippy) to detect rust code issues.
201133

202134
# Community
203135

docs/builtins.md

-30
This file was deleted.

docs/compat-test.md

-17
This file was deleted.

docs/frameTODO.txt

-13
This file was deleted.
Binary file not shown.

docs/notes.md

-13
This file was deleted.

docs/reference.md

-5
This file was deleted.

docs/sharing.md

-43
This file was deleted.

0 commit comments

Comments
 (0)