Skip to content

Commit 19e783d

Browse files
Merge pull request RustPython#1154 from RustPython/coolreader18/update-readmes
Update READMEs
2 parents 42b1b75 + 5821bac commit 19e783d

File tree

9 files changed

+119
-93
lines changed

9 files changed

+119
-93
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Shing Lyu
3+
Copyright (c) 2019 RustPython Team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Lib/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
Standard Library for RustPython
2-
===============================
1+
# Standard Library for RustPython
32

4-
This directory contains all of the Python files that make up the standard library for RustPython.
3+
This directory contains all of the Python files that make up the standard
4+
library for RustPython.
55

6-
Most of these files are copied over from the CPython repository(the 3.7 branch), with slight modifications to allow them
7-
to work under RustPython. The current goal is to complete the standard library with as few modifications as possible.
8-
Current modifications are just temporary workarounds for bugs/missing feature within the RustPython implementation.
6+
Most of these files are copied over from the CPython repository (the 3.7
7+
branch), with slight modifications to allow them to work under RustPython. The
8+
current goal is to complete the standard library with as few modifications as
9+
possible. Current modifications are just temporary workarounds for bugs/missing
10+
feature within the RustPython implementation.
911

10-
The first target is to run the ``unittest`` module, so we can leverage the CPython test suite.
12+
The first big module we are targeting is `unittest`, so we can leverage the
13+
CPython test suite.

README.md

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# RustPython
44

5-
A Python-3 (CPython >= 3.5.0) Interpreter written in Rust :snake: :scream: :metal:.
5+
A Python-3 (CPython >= 3.5.0) Interpreter written in Rust :snake: :scream:
6+
:metal:.
67

78
[![Build Status](https://travis-ci.org/RustPython/RustPython.svg?branch=master)](https://travis-ci.org/RustPython/RustPython)
89
[![Build Status](https://dev.azure.com/ryan0463/ryan/_apis/build/status/RustPython.RustPython?branchName=master)](https://dev.azure.com/ryan0463/ryan/_build/latest?definitionId=1&branchName=master)
@@ -11,9 +12,9 @@ A Python-3 (CPython >= 3.5.0) Interpreter written in Rust :snake: :scream: :meta
1112
[![Contributors](https://img.shields.io/github/contributors/RustPython/RustPython.svg)](https://github.com/RustPython/RustPython/graphs/contributors)
1213
[![Gitter](https://badges.gitter.im/RustPython/Lobby.svg)](https://gitter.im/rustpython/Lobby)
1314

14-
# Usage
15+
## Usage
1516

16-
### Check out our [online demo](https://rustpython.github.io/demo/) running on WebAssembly.
17+
#### Check out our [online demo](https://rustpython.github.io/demo/) running on WebAssembly.
1718

1819
To test RustPython, do the following:
1920

@@ -29,38 +30,44 @@ Or use the interactive shell:
2930
>>>>> 2+2
3031
4
3132

32-
# Disclaimer
33+
## Disclaimer
3334

34-
RustPython is in a development phase and should not be used in production or a fault intolerant setting.
35+
RustPython is in a development phase and should not be used in production or a
36+
fault intolerant setting.
3537

36-
Our current build supports only a subset of Python syntax.
38+
Our current build supports only a subset of Python syntax.
3739

38-
Contribution is also more than welcome! See our contribution section for more information on this.
40+
Contribution is also more than welcome! See our contribution section for more
41+
information on this.
3942

40-
# Conference videos
43+
## Conference videos
4144

4245
Checkout those talks on conferences:
4346

4447
- [FOSDEM 2019](https://www.youtube.com/watch?v=nJDY9ASuiLc)
4548
- [EuroPython 2018](https://www.youtube.com/watch?v=YMmio0JHy_Y)
4649

47-
# Use cases
50+
## Use cases
4851

4952
Allthough rustpython is a very young project, it is already used in the wild:
5053

51-
- [pyckitup](https://github.com/pickitup247/pyckitup): a game engine written in rust.
52-
- [codingworkshops.org](https://github.com/chicode/codingworkshops): a site where you can learn how to code.
54+
- [pyckitup](https://github.com/pickitup247/pyckitup): a game engine written in
55+
rust.
56+
- [codingworkshops.org](https://github.com/chicode/codingworkshops): a site
57+
where you can learn how to code.
5358

54-
# Goals
59+
## Goals
5560

5661
- Full Python-3 environment entirely in Rust (not CPython bindings)
5762
- A clean implementation without compatibility hacks
5863

59-
# Documentation
64+
## Documentation
6065

61-
Currently along with other areas of the project, documentation is still in an early phase.
66+
Currently along with other areas of the project, documentation is still in an
67+
early phase.
6268

63-
You can read the [online documentation](https://rustpython.github.io/website/rustpython/index.html) for the latest code on master.
69+
You can read the [online documentation](https://docs.rs/rustpython-vm) for the
70+
latest release.
6471

6572
You can also generate documentation locally by running:
6673

@@ -71,29 +78,28 @@ $ cargo doc --no-deps --all # Excluding all dependencies
7178

7279
Documentation HTML files can then be found in the `target/doc` directory.
7380

74-
If you wish to update the online documentation, push directly to the `release` branch (or ask a maintainer to do so). This will trigger a Travis build that updates the documentation and WebAssembly demo page.
81+
## Contributing
7582

76-
# Contributing
83+
Contributions are more than welcome, and in many cases we are happy to guide
84+
contributors through PRs or on gitter.
7785

78-
Contributions are more than welcome, and in many cases we are happy to guide contributors through PRs or on gitter.
86+
With that in mind, please note this project is maintained by volunteers, some of
87+
the best ways to get started are below:
7988

80-
With that in mind, please note this project is maintained by volunteers, some of the best ways to get started are below:
89+
Most tasks are listed in the
90+
[issue tracker](https://github.com/RustPython/RustPython/issues). Check issues
91+
labeled with `good first issue` if you wish to start coding.
8192

82-
Most tasks are listed in the [issue tracker](https://github.com/RustPython/RustPython/issues).
83-
Check issues labeled with `good first issue` if you wish to start coding.
93+
Another approach is to checkout the source code: builtin functions and object
94+
methods are often the simplest and easiest way to contribute.
8495

85-
Another approach is to checkout the source code: builtin functions and object methods are often the simplest
86-
and easiest way to contribute.
96+
You can also simply run `./whats_left.sh` to assist in finding any unimplemented
97+
method.
8798

88-
You can also simply run
89-
`./whats_left.sh` to assist in finding any
90-
unimplemented method.
99+
## Using a standard library
91100

92-
# Using a standard library
93-
94-
As of now the standard library is under construction. You can
95-
use a standard library by setting the RUSTPYTHONPATH environment
96-
variable.
101+
As of now the standard library is under construction. You can use a standard
102+
library by setting the RUSTPYTHONPATH environment variable.
97103

98104
To do this, follow this method:
99105

@@ -102,32 +108,38 @@ $ export RUSTPYTHONPATH=~/GIT/RustPython/Lib
102108
$ cargo run -- -c 'import xdrlib'
103109
```
104110

105-
You can play around
106-
with other standard libraries for python. For example,
107-
the [ouroboros library](https://github.com/pybee/ouroboros).
111+
You can play around with other standard libraries for python. For example, the
112+
[ouroboros library](https://github.com/pybee/ouroboros).
108113

109-
# Compiling to WebAssembly
114+
## Compiling to WebAssembly
110115

111116
[See this doc](wasm/README.md)
112117

113-
# Community
118+
## Community
114119

115120
Chat with us on [gitter][gitter].
116121

117-
# Code of conduct
122+
## Code of conduct
118123

119124
Our code of conduct [can be found here](code-of-conduct.md).
120125

121-
# Credit
126+
## Credit
122127

123-
The initial work was based on [windelbouwman/rspython](https://github.com/windelbouwman/rspython) and [shinglyu/RustPython](https://github.com/shinglyu/RustPython)
128+
The initial work was based on
129+
[windelbouwman/rspython](https://github.com/windelbouwman/rspython) and
130+
[shinglyu/RustPython](https://github.com/shinglyu/RustPython)
124131

125132
[gitter]: https://gitter.im/rustpython/Lobby
126133

127-
# Links
134+
## Links
128135

129136
These are some useful links to related projects:
130137

131138
- https://github.com/ProgVal/pythonvm-rust
132139
- https://github.com/shinglyu/RustPython
133140
- https://github.com/windelbouwman/rspython
141+
142+
## License
143+
144+
This project is licensed under the MIT license. Please see the
145+
[LICENSE](LICENSE) file for more details.

benchmarks/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
21
# Benchmarking
32

43
These are some files to determine performance of rustpython.
54

6-
# Usage
5+
## Usage
76

87
Install pytest and pytest-benchmark:
98

@@ -13,7 +12,11 @@ Then run:
1312

1413
$ pytest
1514

16-
# Benchmark source
15+
You can also benchmark the Rust benchmarks by just running
16+
`cargo +nightly bench` from the root of the repository. Make sure you have Rust
17+
nightly installed, as the benchmarking parts of the standard library are still
18+
unstable.
1719

18-
- https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-python3-2.html
20+
## Benchmark source
1921

22+
- https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-python3-2.html

benchmarks/bench.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ extern crate rustpython_parser;
55
extern crate rustpython_vm;
66
extern crate test;
77

8+
use rustpython_compiler::compile;
89
use rustpython_vm::pyobject::PyResult;
9-
use rustpython_vm::{compile, VirtualMachine};
10+
use rustpython_vm::VirtualMachine;
1011

1112
#[bench]
1213
fn bench_tokenization(b: &mut test::Bencher) {
@@ -91,7 +92,7 @@ fn bench_rustpy_nbody(b: &mut test::Bencher) {
9192
// NOTE: Take long time.
9293
let source = include_str!("./benchmarks/nbody.py");
9394

94-
let vm = VirtualMachine::new();
95+
let vm = VirtualMachine::default();
9596

9697
let code = match vm.compile(source, &compile::Mode::Single, "<stdin>".to_string()) {
9798
Ok(code) => code,
@@ -110,7 +111,7 @@ fn bench_rustpy_mandelbrot(b: &mut test::Bencher) {
110111
// NOTE: Take long time.
111112
let source = include_str!("./benchmarks/mandelbrot.py");
112113

113-
let vm = VirtualMachine::new();
114+
let vm = VirtualMachine::default();
114115

115116
let code = match vm.compile(source, &compile::Mode::Single, "<stdin>".to_string()) {
116117
Ok(code) => code,

benchmarks/test_benchmarks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import pytest
66
import subprocess
77

8-
from benchmarks import nbody
9-
108
# Interpreters:
119
rustpython_exe = '../target/release/rustpython'
1210
cpython_exe = sys.executable

tests/README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
# Test snippets
22

3-
This directory contains two sets of test snippets which can be run in
4-
Python. The `snippets/` directory contains functional tests, and the
5-
`benchmarks/` directory contains snippets for use in benchmarking
6-
RustPython's performance.
3+
This directory contains two sets of test snippets which can be run in Python.
4+
The `snippets/` directory contains functional tests, and the `benchmarks/`
5+
directory contains snippets for use in benchmarking RustPython's performance.
76

8-
## Generates the test for not implemented methods
7+
## Setup
98

10-
run using cpython not_impl_gen.py it automatically generate a
11-
test snippet to check not yet implemented methods
9+
Our testing depends on [pytest](https://pytest.org), which you can either
10+
install globally using pip or locally using our
11+
[pipenv](https://docs.pipenv.org).
1212

13-
## Running with CPython + RustPython
13+
## Running
1414

15-
One way to run these snippets is by using CPython to do the parsing and
16-
compilation to bytecode. When this is done, run the bytecode with rustpython.
17-
18-
## Running with RustPython
19-
20-
The other option is to run all snippets with RustPython.
15+
Simply run `pytest` in this directory, and the tests should run (and hopefully
16+
pass). If it hangs for a long time, that's because it's building RustPython in
17+
release mode, which should take less time than it would to run every test
18+
snippet with RustPython compiled in debug mode.

wasm/README.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
21
# Compiling to webassembly
32

4-
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.
3+
At this stage RustPython only has preliminary support for web assembly. The
4+
instructions here are intended for developers or those wishing to run a toy
5+
example.
56

67
## Setup
78

8-
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)
9+
To get started, install
10+
[wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) and `npm`.
11+
([wasm-bindgen](https://rustwasm.github.io/wasm-bindgen/whirlwind-tour/basic-usage.html)
12+
should be installed by `wasm-pack`. if not, install it yourself)
913

1014
<!-- Using `rustup` add the compile target `wasm32-unknown-emscripten`. To do so you will need to have [rustup](https://rustup.rs/) installed.
1115
@@ -25,26 +29,26 @@ cd emsdk-portable/
2529

2630
## Build
2731

28-
Move into the `wasm` directory. This directory contains a library crate for interop
29-
with python to rust to js and back in `wasm/lib`, the demo website found at
30-
https://rustpython.github.io/demo in `wasm/demo`, and an example of how to use
31-
the crate as a library in one's own JS app in `wasm/example`.
32+
Move into the `wasm` directory. This directory contains a library crate for
33+
interop with python to rust to js and back in `wasm/lib`, the demo website found
34+
at https://rustpython.github.io/demo in `wasm/demo`, and an example of how to
35+
use the crate as a library in one's own JS app in `wasm/example`.
3236

3337
```sh
3438
cd wasm
3539
```
3640

37-
Go to the demo directory. This is the best way of seeing the changes made to either
38-
the library or the JS demo, as the `rustpython_wasm` module is set to the global
39-
JS variable `rp` on the website.
41+
Go to the demo directory. This is the best way of seeing the changes made to
42+
either the library or the JS demo, as the `rustpython_wasm` module is set to the
43+
global JS variable `rp` on the website.
4044

4145
```sh
4246
cd demo
4347
```
4448

45-
Now, start the webpack development server. It'll compile the crate and then
46-
the demo app. This will likely take a long time, both the wasm-pack portion and
47-
the webpack portion (from after it says "Your crate has been correctly compiled"),
49+
Now, start the webpack development server. It'll compile the crate and then the
50+
demo app. This will likely take a long time, both the wasm-pack portion and the
51+
webpack portion (from after it says "Your crate has been correctly compiled"),
4852
so be patient.
4953

5054
```sh
@@ -56,17 +60,24 @@ the text box or browser devtools with:
5660

5761
```js
5862
rp.pyEval(
59-
`
63+
`
6064
print(js_vars['a'] * 9)
6165
`,
62-
{
63-
vars: {
64-
a: 9
66+
{
67+
vars: {
68+
a: 9
69+
}
6570
}
66-
}
6771
);
6872
```
6973

70-
Alternatively, you can run `npm run build` to build the app once, without watching
71-
for changes, or `npm run dist` to build the app in release mode, both for the
72-
crate and webpack.
74+
Alternatively, you can run `npm run build` to build the app once, without
75+
watching for changes, or `npm run dist` to build the app in release mode, both
76+
for the crate and webpack.
77+
78+
## Updating the demo
79+
80+
If you wish to update the WebAssembly demo,
81+
[open a pull request](https://github.com/RustPython/RustPython/compare/release...master)
82+
to merge `master` into the `release` branch. This will trigger a Travis build
83+
that updates the demo page.

wasm/lib/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A Python-3 (CPython >= 3.5.0) Interpreter written in Rust.
1313

1414
## Usage
1515

16-
### Check out our [online demo](https://rustpython.github.io/demo/) running on WebAssembly.
16+
#### Check out our [online demo](https://rustpython.github.io/demo/) running on WebAssembly.
1717

1818
## Goals
1919

0 commit comments

Comments
 (0)