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

Uploaded CPython 3.14macOS 11.0+ ARM64

subtr_actor_py-0.8.1-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

subtr_actor_py-0.8.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.8.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

subtr_actor_py-0.8.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

subtr_actor_py-0.8.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: subtr_actor_py-0.8.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.8.1.tar.gz
Algorithm Hash digest
SHA256 9652e499cf8ae6633066c99076cb218a91207164591e7bc5f3b43c8a89e58aaf
MD5 7c80806ff23b3a79afd591a8a0af799f
BLAKE2b-256 07ecbf4af0a5f7cc9fd1b84886755015e9d01b7e44905daa07dc065fff3af237

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e329eaa05f5071ec74a3f78058ff8ecc88dbba014395489b853a789b89d4aab
MD5 d90866682e73d1c4c59ed82b2ce50a95
BLAKE2b-256 77cb8552cf86cd2f7064d817fd76b26fbaf252d014ad6c28a4426ab6729d1b34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 673c1a7edf95cf161d759d1b46a4817384589e66b89d62a1999077427fed45b7
MD5 3b78b4463b212cffa8ba3803c27d9ddb
BLAKE2b-256 e52574a745dd8a443acbfaa0d2d11b436f43384fe1ad336851ce303c1fbd75f8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b47c0479549621b89f92034439c1d3a0ccdab149b0b89e9662a3cfd421ca8966
MD5 788a7357a64b42a890334aa946fe1f9b
BLAKE2b-256 e1e69eb46e5dc27debe4e85c7bb83f1d986313c19711a4d1149e1427f078ed67

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d576ae2e89006c296d2b308917398b1c51f1a771caf341191448417708698907
MD5 f06dddc41d99445e9aedce2b261e58ca
BLAKE2b-256 d7665d54c5f5789f1a3c9af21a3ba82c22885f238e153dfde417235f8e8d986f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e679d7cb20ed2f3a79399a4ab155ab7f0f032a21a09465fbe280732d51f38bd0
MD5 e9da1fb211468a698e88f056003670a2
BLAKE2b-256 175ee92f9c2253129ab38960e4f4736b16a1939c103c431b27a2602a86947b91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 37ccd78cbc33563bcb168d509041348964919437fcc8c534031ea935cd2220ad
MD5 a901f1007f30622b1c442629c3e16a25
BLAKE2b-256 9c5da0a85feecb609dc4618807713c1733a461f31fbdbad3a90655248c126f93

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b16fd4cefaf57722c8f13ee6ded358491e215519dae1da80152990d1104fa3a0
MD5 584c08429b64a94f32708b2d21e34f45
BLAKE2b-256 2608b785575e46b98b75948211af52964605813baf58299c0c0faa376ad5ce8c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for subtr_actor_py-0.8.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 54e24061c13558472fe37f8cb94acdbbee5eefbc0df87f27895dd0549f201be1
MD5 6177f413c8b0cafcf06e6aa54d034656
BLAKE2b-256 b25ad8e51097da9160d4ddbe563e551402c59ad303d72038ca417c808f3a7fef

See more details on using hashes here.

Provenance

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