Skip to main content

Python wrapper for the ROM browser-like runtime

Project description

rom-runtime

Python bindings for the ROM browser-like runtime.

This package exposes a thin Python API on top of ROM:

  • eval()
  • eval_async()
  • eval_json()
  • surface_snapshot()
  • fingerprint_probe()
  • run_fingerprintjs_harness()
  • fingerprintjs_version()

It prefers a native PyO3 extension when available and falls back to the ROM CLI bridge otherwise.

Install

pip install rom-runtime

Usage

from rom import RomRuntime, has_native_binding

runtime = RomRuntime(
    {
        "href": "https://example.test/",
        "referrer": "https://referrer.example/",
        "cors_enabled": False,
        "proxy_url": None,
    }
)
href = runtime.eval_async("(async () => location.href)()")
snapshot = runtime.surface_snapshot()

print("native:", has_native_binding())
print(href)
print(snapshot["fetch"])

runtime.eval_async("(async () => { globalThis.__rom_value = 42; return 'ok'; })()")
print(runtime.eval_async("(async () => String(globalThis.__rom_value))()"))

Config keys use the Rust runtime field names, so use snake_case such as cors_enabled and proxy_url. cors_enabled is False by default. When the native extension is loaded, one RomRuntime instance keeps JS globals alive across multiple eval() and eval_async() calls.

Optional native build from source

python -m pip install maturin
python -m maturin build --manifest-path bindings/gom-python/Cargo.toml --release

Tagged GitHub releases build and publish wheels for Linux, Windows, and macOS, plus an sdist for source installs.

Common methods

  • eval()
  • eval_async()
  • eval_json()
  • surface_snapshot()
  • fingerprint_probe()
  • run_fingerprintjs_harness()
  • fingerprintjs_version()

Environment

  • ROM_FORCE_CLI_BRIDGE=1: disable the native path and force CLI fallback
  • ROM_BRIDGE_BIN: explicit path to the rom_bridge executable
  • ROM_BRIDGE_CWD: working directory used by the CLI fallback

More docs

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

rom_runtime-0.0.7.tar.gz (135.8 kB view details)

Uploaded Source

Built Distributions

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

rom_runtime-0.0.7-cp39-abi3-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

rom_runtime-0.0.7-cp39-abi3-manylinux_2_38_x86_64.whl (3.3 MB view details)

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

rom_runtime-0.0.7-cp39-abi3-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rom_runtime-0.0.7-cp39-abi3-macosx_10_12_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file rom_runtime-0.0.7.tar.gz.

File metadata

  • Download URL: rom_runtime-0.0.7.tar.gz
  • Upload date:
  • Size: 135.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rom_runtime-0.0.7.tar.gz
Algorithm Hash digest
SHA256 1ad42a069361972e255da3ac9b8c3c3d3146221973c73ec948e37cf7a9a72302
MD5 10abade622ffe86471d60d1cf2778b96
BLAKE2b-256 6d47e1b9483dbf5ee5365523d4baf08690ac4b4e3f059c405cfd0adefe915415

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.7.tar.gz:

Publisher: release-bindings.yml on Rxflex/rom

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

File details

Details for the file rom_runtime-0.0.7-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rom_runtime-0.0.7-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rom_runtime-0.0.7-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 da101b347a7c4085ba25d2b7ed652957ba712cfc24d5cc01c8b7e75182723e26
MD5 d40f0ac900adf71e0ac1a4727cae12ae
BLAKE2b-256 98fd4edef601219f6e4c83d50af47d9d1b1b3aef7a9aa7e8e11196fa63b2aa01

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.7-cp39-abi3-win_amd64.whl:

Publisher: release-bindings.yml on Rxflex/rom

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

File details

Details for the file rom_runtime-0.0.7-cp39-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.7-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 feb7d93f6a191da1098f42b7ba1725327510ad8b8ae1d3d95558c3eb660f111a
MD5 76cf030a047413db2e5a6af78aa59323
BLAKE2b-256 27857caee8721981127a25ddbe0950ec364639e3210546b1990566d8c9548d21

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.7-cp39-abi3-manylinux_2_38_x86_64.whl:

Publisher: release-bindings.yml on Rxflex/rom

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

File details

Details for the file rom_runtime-0.0.7-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.7-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98315a181ee10670f3b6bdae0360e34f540866e4658a97d98ecb02e510caaf14
MD5 91cddd616f4f164374777899aaf8fb85
BLAKE2b-256 33c871a536bd69e94ef382fb5f5291520078a333da5a3f508c2877ea458ff3dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.7-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release-bindings.yml on Rxflex/rom

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

File details

Details for the file rom_runtime-0.0.7-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.7-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9f418eb5ebd1d18aaa28c2ef0b64cc9b9f05fb541aa1fb9777021ecea753a3d0
MD5 73fcb7c38bf2f43728dce77a5277ef10
BLAKE2b-256 18b0329feb1719679f63e851540ad293134f20727a54891791174612412662b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.7-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release-bindings.yml on Rxflex/rom

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