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
To build from source instead, first install Rust. Then:
pip install maturin
maturin develop
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.1-cp39-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c06e45d54e78fd60ca10483f83335d0467d3f4cf86c7d2174f5a8fd020b22086 |
|
MD5 | 9f9a8f1d69eacf6023c23fce0462f9e8 |
|
BLAKE2b-256 | 1cf7a7dc0a4a10b81076d6579c9f283e0c71cbc229ea8a438caedd5551b65766 |
Hashes for peppi_py-0.7.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bef1a1cf72f7af770cb86173230e23d87d7ec849ad56112c9ccd5fd2a1d26586 |
|
MD5 | b8ace3da48e0606e3c0f41e556ae9958 |
|
BLAKE2b-256 | afe06b26c3635574ef81fa4e5f607230fe4be0b1ff3f9fa5ae1bb4916b8b724e |
Hashes for peppi_py-0.7.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 506dde02df21d923e89da0ffa090b157daf505220aac506acd8ecc960b9f426d |
|
MD5 | c55f2d62484e2ec56c5f873cefb724d6 |
|
BLAKE2b-256 | 4d3ae52ad5b93fcf181b474ae126bb3819594cb87525d0c94f551b7d36883dbb |
Hashes for peppi_py-0.7.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98e43f4b043c9220ca861de80bfbb26fca99f2987937a702382de1757067d31c |
|
MD5 | d25ac7c2dc6c72200eb8dcd42b75db7d |
|
BLAKE2b-256 | 355dddef0f31678d6caec3aa65be82ac6e90685bd29bed558c645ac6de2922bf |