Skip to main content

Python bindings for the Rocket League replay processing library subtr-actor.

Project description

subtr-actor-py

Python bindings for subtr-actor, a Rocket League replay processing library.

Installation

pip install subtr-actor-py

Usage

import subtr_actor

replay_path = "path/to/replay.replay"

# Parse raw replay bytes into the full replay structure.
with open(replay_path, "rb") as replay_file:
    replay = subtr_actor.parse_replay(replay_file.read())

# Build a numpy ndarray plus metadata.
meta, ndarray = subtr_actor.get_ndarray_with_info_from_replay_filepath(
    replay_path,
    global_feature_adders=["BallRigidBody", "SecondsRemaining"],
    player_feature_adders=["PlayerRigidBody", "PlayerBoost", "PlayerAnyJump"],
    fps=10.0,
    dtype="float32",
)

headers = subtr_actor.get_column_headers(
    global_feature_adders=["BallRigidBody", "SecondsRemaining"],
    player_feature_adders=["PlayerRigidBody", "PlayerBoost"],
)

replay_meta = subtr_actor.get_replay_meta(replay_path)
frames_data = subtr_actor.get_replay_frames_data(replay_path)
stats_module_names = subtr_actor.get_stats_module_names()
stats = subtr_actor.get_stats(replay_path, module_names=["core", "boost", "movement"])
stats_snapshot_data = subtr_actor.get_stats_snapshot_data(
    replay_path,
    module_names=["core", "boost"],
    frame_step_seconds=1.0,
)
stats_timeline = subtr_actor.get_stats_timeline(
    replay_path,
    module_names=["core", "boost", "movement"],
    frame_step_seconds=1.0,
)

print(ndarray.shape)
print(headers["player_headers"][:5])
print(replay_meta["map_name"])
print(stats_module_names)
print(stats["modules"]["core"]["team_zero"]["score"])
print(stats_snapshot_data["frames"][-1]["modules"]["boost"]["team_zero"]["amount_collected"])
print(stats_timeline["frames"][-1]["team_zero"]["boost"]["amount_collected"])

API Surface

parse_replay(data: bytes) -> dict

Parse raw replay bytes and return the full replay structure as Python data.

get_ndarray_with_info_from_replay_filepath(filepath, global_feature_adders=None, player_feature_adders=None, fps=None, dtype=None) -> tuple[dict, numpy.ndarray]

Process a replay file and return metadata plus a numpy.ndarray.

Parameters:

  • filepath: path to the replay file
  • global_feature_adders: list of global feature names, default ["BallRigidBody"]
  • player_feature_adders: list of player feature names, default ["PlayerRigidBody", "PlayerBoost", "PlayerAnyJump"]
  • fps: target FPS for resampling, default 10.0
  • dtype: output dtype string. Supported values are float16/f16/half, float32/f32, and float64/f64/double

get_replay_meta(filepath, global_feature_adders=None, player_feature_adders=None) -> dict

Get replay metadata and ndarray headers without materializing the full ndarray.

get_column_headers(global_feature_adders=None, player_feature_adders=None) -> dict

Get header information for the configured ndarray layout.

get_replay_frames_data(filepath) -> dict

Get structured frame-by-frame game state data with no FPS resampling.

get_stats_module_names() -> list[str]

List the builtin stats modules that can be selected in get_stats, get_stats_snapshot_data, and get_stats_timeline.

get_stats(filepath, module_names=None) -> dict

Get aggregate replay stats for the selected builtin modules.

Parameters:

  • filepath: path to the replay file
  • module_names: optional list of builtin stats module names. By default all builtin modules are included.

get_stats_snapshot_data(filepath, module_names=None, frame_step_seconds=None) -> dict

Get the raw stats snapshot payload produced by StatsCollector, including:

  • config: module configuration emitted by the selected stats modules
  • modules: aggregate module outputs
  • frames: per-sample module snapshots keyed by module name

Parameters:

  • filepath: path to the replay file
  • module_names: optional list of builtin stats module names. By default all builtin modules are included.
  • frame_step_seconds: optional positive sampling interval in seconds. By default every replay frame is captured.

get_stats_timeline(filepath, module_names=None, frame_step_seconds=None) -> dict

Get cumulative typed stats snapshots for each replay sample.

Parameters:

  • filepath: path to the replay file
  • module_names: optional list of builtin stats module names. By default all builtin modules are included.
  • frame_step_seconds: optional positive sampling interval in seconds. By default every replay frame is captured.

Feature Adders

See the subtr-actor ndarray docs for the full list of feature-adder names.

Common global features:

  • BallRigidBody
  • CurrentTime
  • SecondsRemaining

Common player features:

  • PlayerRigidBody
  • PlayerBallDistance
  • PlayerBoost
  • PlayerAnyJump
  • PlayerJump
  • PlayerDodgeRefreshed

PlayerBoost is exposed in raw replay units (0-255), not 0-100 percent.

Development

Repository-level compile check:

just build-python

For an importable local Python environment, use maturin develop from the python/ directory:

cd python
uv sync --group dev
uv run maturin develop
uv run pytest

If you are using the repo flake, nix develop now provides the pinned CPython 3.11 toolchain and Python dev dependencies via uv2nix. Create a writable virtual environment from that interpreter, then install the local extension into it:

nix develop
uv venv /tmp/subtr-actor-venv
source /tmp/subtr-actor-venv/bin/activate
cd python
maturin develop
pytest

If you are not using uv or Nix, install maturin, pytest, and numpy in a virtual environment and run maturin develop directly.

Publishing Notes

This binding depends on the workspace crate via:

[dependencies.subtr-actor]
path = ".."
version = "0.4.0"

That keeps local development wired to the workspace crate while still pinning the published dependency version. Use just bump <version> to update the workspace and binding versions together.

License

MIT

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

subtr_actor_py-0.6.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

subtr_actor_py-0.6.1-cp314-cp314-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

subtr_actor_py-0.6.1-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

subtr_actor_py-0.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

File details

Details for the file subtr_actor_py-0.6.1.tar.gz.

File metadata

  • Download URL: subtr_actor_py-0.6.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for subtr_actor_py-0.6.1.tar.gz
Algorithm Hash digest
SHA256 3d939e873c4f9a00e95214b75f3851bc1de0911aee830465fef1893a15f4fb25
MD5 1890342146a2f00d030833bfc7ddb890
BLAKE2b-256 0c4666bce9dbc3fb65cb8ff0795fc8a1801952975ae6b12f0827ab1df99b773b

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1.tar.gz:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f30f5f92ae1bed01d19a3c47b3e881b7a8699bb5cfa34b2165b1c55902ae8f83
MD5 443a542d049c4d1dd093755f889b621a
BLAKE2b-256 9499d747563d79317b5451d7e655b18443bf352b8378ecd2a92d552a7695bbcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cf58d3f5369596d654f0eea947364b2862566c08281b33c5a508c2ef15e37893
MD5 29e89cf595da5703c58498450ff7ef26
BLAKE2b-256 c9a7520105740dfc8244d71654b9c4d59b57c38624839222f6dd2903ac3533be

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp312-cp312-win_amd64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 46a6bc3364927e92d4c5a6a58b17805c1d77aa958b9ad0eca008804ca8e8d639
MD5 e4162359c7477ace81dce76bdc872035
BLAKE2b-256 202e72793269aea5c6beb16f70a158a34a1a0148129b28e29c12db85c031ba61

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f2139e46e5eaa711f0e250b83025e2a3a60f96d668acd7bc6f8a8afb0f551eb8
MD5 949e60af519724915ca382a7eb983042
BLAKE2b-256 34186a99a5449a10fdd38cc6d634fc196858c3287916f5e864861a5658ed7ecd

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d15ed0c993db70d33ae73f21ff441a6d3e568bd5bc3aef01902af73651f579d1
MD5 88cd2c7c2e18ef3077a4b6b6567b34ea
BLAKE2b-256 268d831ea5df4dfb3670149c3b20ecc566128755ddd14a56fe2418a0a6175d12

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f693f6c54c3cc8acc16bbf9d9e0b406402f7d3c29dd66659b8f43370b0f52d3c
MD5 ae7d1c19de97f4cc278f0624cdd02351
BLAKE2b-256 04681318964572c65a069e4b072894ef5c17ea43277d8cf84e57124aeed33d0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eba8a9cc32baa6f21c222f5200ba4a455d0163de21faf7f8693de6d1462167ec
MD5 ccf73714fcbd6879217db507ab8b8b3f
BLAKE2b-256 37eaa91c828b2229ed18e0858dcc526eccb4316a87992adeb9d95a8a3bec40a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file subtr_actor_py-0.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 36af77f79eda128d0740413a8b10d68f63f24c67a86ada02e74096fc48f3f05b
MD5 c9022b7e12870fe9fd95442740f82fc0
BLAKE2b-256 0972b58a4f317734708020772d00c9efdc83abc4688bc3ea5b0069474c31ee5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.6.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-python.yml on rlrml/subtr-actor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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