|
1 | 1 |
|
2 | 2 | # arcade-accelerate |
3 | 3 |
|
4 | | -An experimental library for accelerating arcade using rust. The module can |
5 | | -be imported and monkey patch arcade replacing functions and types with rust |
6 | | -versions. |
| 4 | +An experimental library for accelerating [Arcade](https://github.com/pythonarcade/arcade) using Rust. The module can |
| 5 | +be imported and monkey patch Arcade, replacing functions and types with rust versions. |
7 | 6 |
|
8 | 7 | ```py |
9 | 8 | import arcade_accelerate |
10 | 9 | arcade_accelerate.bootstrap() |
11 | | -``` |
12 | | - |
13 | | -## Build / Setup |
14 | 10 |
|
15 | | -* Install maturin |
16 | | - * `pip install maturin` |
17 | | - * (Package crated with 0.14.15) |
18 | | -* Install the arcade version you are comparing with |
19 | | - * Preferably install from source in editable mode |
| 11 | +import arcade |
| 12 | +``` |
20 | 13 |
|
21 | | -Install the create as module in the current virtualenv |
| 14 | +It is important to run the arcade-accelerate bootstrapping process before importing Arcade, otherwise the monkey-patched versions will not be fully applied. |
22 | 15 |
|
23 | | -```sh |
24 | | -# debug |
25 | | -maturin develop |
26 | | -# release |
27 | | -maturin develop --release |
28 | | -``` |
| 16 | +## Build / Setup |
29 | 17 |
|
30 | | -Build python package for release |
| 18 | +First create and activate a Python virtual environment, then install maturin: |
31 | 19 |
|
32 | 20 | ```bash |
33 | | -# wheel |
34 | | -maturin build -i python --release |
35 | | -# sdist |
36 | | -maturin build -i python --release --sdist |
| 21 | +pip install maturin |
37 | 22 | ``` |
38 | 23 |
|
39 | | -When performance testing always use the release build. |
| 24 | +Install the crate as module in the current virtual environment using Maturin. Generally |
| 25 | +when working on performance enhancements you will want to use the `--release` flag. |
40 | 26 |
|
41 | | -## Info |
42 | | - |
43 | | -This project has a python module and a rust module. |
| 27 | +```sh |
| 28 | +# Debug |
| 29 | +maturin develop |
44 | 30 |
|
45 | | -* `arcade_accelerate` - python module |
46 | | -* `arcade_accelerate_rust` - rust module |
| 31 | +# Release |
| 32 | +maturin develop --release |
| 33 | +``` |
47 | 34 |
|
48 | | -The python module just contains some helper functions to bootstrap the |
49 | | -acceleration. |
| 35 | +Then you can install [Arcade](https://github.com/pythonarcade/arcade) into the same virtual environment |
| 36 | +and run any of it's examples. Optimally testing should be done against the `development` branch of Arcade. |
| 37 | +In order to enable `arcade-accelerate` add these two lines anytime before importing `arcade`. It is important that |
| 38 | +the bootstrap is done prior to importing Arcade, otherwise the monkey-patched functions/classes will not fully apply. |
50 | 39 |
|
51 | | -The `tests` directory contains some performance tests. |
| 40 | +```py |
| 41 | +import arcade_accelerate |
| 42 | +arcade_accelerate.bootstrap() |
52 | 43 |
|
53 | | -# Resources |
| 44 | +import arcade |
| 45 | +``` |
54 | 46 |
|
55 | | -* [pyo3 user guide](https://pyo3.rs) |
56 | | -* [maturin user guide](https://www.maturin.rs/) |
| 47 | +If you would like to run Arcade's test suite with arcade-accelerate enabled, you can do so by setting the `ARCADE_PYTEST_USE_RUST` environment variable before running pytest on Arcade. You just need to ensure that both Arcade and arcade-accelerate are installed in the same environment. |
0 commit comments