No project description provided
Project description
peppi-py
Python bindings for the peppi replay parser for Slippi, built using Apache Arrow and PyO3.
Installation
pip install peppi-py
Usage
There are two functions in peppi_py
:
read_slippi(path, skip_frames = True)
read_peppi(path, skip_frames = True)
Both of these parse a replay file (.slp
or .slpp
respectively), and return an object with these keys:
start
end
metadata
hash
frames
The first three are regular dicts, but frames
is an Arrow StructArray
object. This can be treated as an array of dicts, but thanks to Arrow's columnar format you can do many other things such as convert columns to numpy arrays. See the pyarrow docs for more, particularly StructArray and StructScalar (which is what you get when you subscript a StructArray
).
Also see the Slippi replay spec for detailed information about the available fields and their meanings.
⚠️ peppi-py is still alpha, so expect breaking changes!
>>> import peppi_py
>>> game = peppi_py.read_slippi('game.slp')
>>> game.metadata
{'lastFrame': 11238,
'playedOn': 'dolphin',
'players': {'0': {'characters': {'18': 11469},
'names': {'code': 'AAAA#123', 'netplay': 'abbott'}},
'1': {'characters': {'17': 11469},
'names': {'code': 'BBBB#456', 'netplay': 'costello'}}},
'startAt': '2020-08-01T19:41:19Z'}
>>> f = game.frames[0]
>>> f['ports'][0]['leader']['post']['position']
<pyarrow.StructScalar: {'x': -42.0, 'y': 26.600000381469727}>
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 Distribution
Hashes for peppi_py-0.6.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a73a10985bd25604c2c5b9fdab0d338aa849c740ce2a1157c29ba2d7cfa8c2b2 |
|
MD5 | 07c88bdc966ba72a621a8fc1ff34d843 |
|
BLAKE2b-256 | e7837a112ca198cd1e797b4842c975b8d921e87bb611aafab6ec28143a45b479 |