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
Copy file name to clipboardExpand all lines: README.md
+33-18Lines changed: 33 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,36 @@ A Python module implemented in Rust for fast and safe serialization and deserial
4
4
5
5
### The goal of this project
6
6
7
-
A majority of the code is auto-generated in the`codegen/` upon first compile
7
+
A majority of the code is auto-generated by`codegen/` upon first compile
8
8
using the RLBot's schema as defined by the `flatbuffers-schema` submodule.
9
9
10
10
This includes the code generated by Planus (`src/planus_flat.rs`),
11
11
the Python wrapper binds to the generated Rust code (`src/python/`),
12
12
and the Python type hints (`rlbot_flatbuffers.pyi`).
13
13
14
+
Usage of this API should not significantly differ from RLBot v4 to reduce developer confusion, while not holding back changes that would make the API easier to work with.
15
+
16
+
### Minimum support Python version
17
+
18
+
The crate used to generate Python binds (PyO3) supports all the way back to Python 3.7, however the minimum supported Python version is 3.10 for a few reasons:
19
+
20
+
1. RLBot v4 currently runs Python 3.11
21
+
1. The RLBot v5's [Python interface](https://github.com/RLBot/python-interface) has a minimum Python version of 3.11, but the difference between 3.10 and 3.11 doesn't mean much for these binds specifically.
22
+
1. Python 3.10 is the version of Python that added `match`/`case`
23
+
1.[Python 3.7 & 3.8 are EOL, with 3.9's EOL date being 2025-10](https://devguide.python.org/versions/)
24
+
14
25
### Dev setup
15
26
16
27
- Ensure Python 3.10+ is installed
17
28
- Create a virtual Python environment
18
-
-`python3 -m venv venv`
29
+
-`python3 -m venv venv`
19
30
- Activate the virtual environment
20
-
- Windows: `venv\Scripts\activate.bat`
21
-
- Linux: `source venv/bin/activate`
31
+
- Windows: `venv\Scripts\activate.bat`
32
+
- Linux: `source venv/bin/activate`
22
33
- Install maturin
23
-
-`pip install maturin`
34
+
-`pip install maturin`
24
35
- Build & install for testing
25
-
-`maturin develop --release`
36
+
-`maturin develop --release`
26
37
27
38
To use in another Python environment, like if testing [python-interface](https://github.com/RLBot/python-interface), you can build the wheel:
The goal of the above was to feel familiar to RLBot v4 while providing a more Pythonic interface.
99
110
111
+
- Unions aren't custom types, rather a normal Python variable that can be 1 of a few types.
112
+
- For example, previously [`BallInfo.shape` had the separate type `CollisionShape` which contained the union's data](https://github.com/RLBot/RLBot/blob/e34dd4598bc643e2b8e50b77f7ffe4ca38e335de/src/main/python/rlbot/utils/structures/game_data_struct.pyi#L65-L95) but the type is now just `BoxShape | CylinderShape | SphereShape`
113
+
100
114
- Classes implement `__match_args__` for easy destructuring via the `match`/`case` pattern.
101
-
- Enums and unions and can still be used to match against the type,
102
-
they just can't be destructured.
103
-
- Classes, enums, and unions properly implements `__str__` and `__repr__`.
115
+
- Enums can still be used to match against the type,
116
+
they just can't be destructured.
117
+
- Classesand enums properly implement `__repr__`, with `__str__` being an alias.
104
118
- Enums implement `__hash__`, `__int__` and `__eq__`.
105
119
- Lists no longer have `num_x` fields accompanying them,
106
120
they are just Python lists of the appropriate length.
107
121
- Classes implement `pack` and `unpack`,
108
122
which are used to serialize and deserialize data.
109
-
110
-
These are public methods that can be used directly for any purpose,
111
-
for example saving `flat.GamePacket` to a file.
123
+
- These are public methods that can be used directly for any purpose,
124
+
for example saving `flat.GamePacket` to a file.
125
+
126
+
- Auto-generated python type stub (`.pyi`) generation that includes doc comments from the Flatbuffers schema
0 commit comments