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.7.0.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.7.0-cp314-cp314-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

subtr_actor_py-0.7.0-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12Windows x86-64

subtr_actor_py-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

subtr_actor_py-0.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: subtr_actor_py-0.7.0.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.7.0.tar.gz
Algorithm Hash digest
SHA256 3fb8f0a0ceeff1f0c9e8d4cf0dd598541ff5cbbb4a5c32e09e6e1ffd25de71a0
MD5 8cdf768d1b39a4dba28070d0959137ea
BLAKE2b-256 da95683e05c9c5810dea58efb87343eb49b37f3254cd1598f834e54b72dc3ea2

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0.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.7.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8663bf097e613896b1d698b2e0ebe9d21663d4b3f7f6297f6c4e59cfb6d9bc6
MD5 4d8e90be89271a758bc5d2fe613600cc
BLAKE2b-256 61c356c2e24d6aea7d9e4d88586a29787bd2383b08361fd5de7d5718ce2cbf87

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fc0badc36dce99fbff064c4c24827737e882146ecc9251987ece43b4819ded78
MD5 53c71475f01e8285be91cc3ee30df63b
BLAKE2b-256 2ce0ca22e9d7c770e398f7f88c8f7ef9b0cfcfb5e175321737cfaa9c0d7f972a

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0e865ca9e0b2c728c0318ca3d4d29c67bd60c1f2c4467a00fbe995576d49de1
MD5 cf9956083b7ebf742bf2c362059b435b
BLAKE2b-256 d10ab6e206ec49c429d71cf6a78bca3fc5a434df6ffb779e9d6d15e4bec60732

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6a0fcdee0e596c9b9501d7e05c6abc5b5735e82c5346e195c0defbe17a31c5e0
MD5 fff92acc7e66fd6f4be325291379094c
BLAKE2b-256 100e89e6c33d4b7e2fcd31565d372f130cda721fa28de5d0dc8b454dc2c6e660

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7e17f0855ef1efbb546f0a0084affde4112b41b554375831f3c6aa8ad130608a
MD5 9a4d163548850c73470dea0ba8fdd25b
BLAKE2b-256 dd27f14fe5e7ea1497c428a15de1c6643c9d65f7974682fe97f63525041585f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dfdc751f1459cfe8f03bb654e29261f47639f3eca7957c108fbec2e062226bc6
MD5 902adc519e412b9d13aeb0c212f5c7eb
BLAKE2b-256 0c62051cc4775b801aea37a698162ca5a257ea87036c12e48521b45ef658c3a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e98b9473eae5d5616d1723d6f2efa1e23490105b947b626baf23ec27526d1dfb
MD5 b0fb0d9cb5f816caf1776ca602622dc4
BLAKE2b-256 9af5c28cb1a4cfe8498101b331cf19ae26b40d611c5b45866b4adf52a74638e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for subtr_actor_py-0.7.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 846656776406d0889a46c74973b6a33856dcf44737a37a7a4260d51a77c95616
MD5 bd4fe3cc82d3354f6ac1377bb2b0a6f3
BLAKE2b-256 37677eea27595f83482da33aa08e8f6d21e7c5902cb1808fbcc29f34917b7f03

See more details on using hashes here.

Provenance

The following attestation bundles were made for subtr_actor_py-0.7.0-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