No project description provided
Project description
peppi-py
Python bindings for the peppi Slippi replay parser, built using Apache Arrow and PyO3.
Installation
pip install peppi-py
Usage
peppi-py exposes two functions:
read_slippi(path, skip_frames=False)
read_peppi(path, skip_frames=False)
Both of these parse a replay file (.slp
or .slpp
respectively) into a Game
object.
Frame data is stored as a struct-of-arrays for performance, using Arrow. So to get the value of an attribute "foo.bar" for the n
th frame of the game, you'd write game.frames.foo.bar[n]
instead of game.frames[n].foo.bar
. See the code example below.
You can do many other things with Arrow arrays, such as converting them to numpy arrays. See the pyarrow docs for more, particularly the various primitive array types such as Int8Array.
Also see the Slippi replay spec for detailed information about the available fields and their meanings.
>>> from peppi_py import read_slippi, read_peppi
>>> game = read_slippi('tests/data/game.slp')
>>> game.metadata
{'startAt': '2018-06-22T07:52:59Z', 'lastFrame': 5085, 'players': {'1': {'characters': {'1': 5209}}, '0': {'characters': {'18': 5209}}}, 'playedOn': 'dolphin'}
>>> game.start
Start(slippi=Slippi(version=(1, 0, 0)), ...)
>>> game.end
End(method=<EndMethod.RESOLVED: 3>, lras_initiator=None, players=None)
>>> game.frames.ports[0].leader.post.position.x[0]
<pyarrow.FloatScalar: -42.0>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for peppi_py-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16b0587db3932ac2a2be7792d6ac3bc209d8199d9b10f22f888683c0b50e1783 |
|
MD5 | a373cec24ba49550a66383a079d9cbf2 |
|
BLAKE2b-256 | 956977c1846c762f181d8a51413aea958ceb228535227c17f55f822b9acf4ea9 |
Hashes for peppi_py-0.7.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e44579e1903e8c41e7bed24d74e1fb3a23fd522c401d658c291b40567d403a4 |
|
MD5 | 9e14cdba865e3460d40523943b14f7e9 |
|
BLAKE2b-256 | c52740ee8d6b8e3ed034aa83651d87463b6c249a4c38b342cf6cbf7116da656a |