Skip to main content

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 nth 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peppi_py-0.7.0.tar.gz (66.1 MB view hashes)

Uploaded Source

Built Distributions

peppi_py-0.7.0-cp39-abi3-manylinux_2_28_x86_64.whl (960.1 kB view hashes)

Uploaded CPython 3.9+ manylinux: glibc 2.28+ x86-64

peppi_py-0.7.0-cp39-abi3-macosx_11_0_arm64.whl (817.8 kB view hashes)

Uploaded CPython 3.9+ macOS 11.0+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page