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.8.tar.gz (139.9 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.8-cp39-abi3-win_amd64.whl (3.1 MB view details)

Uploaded CPython 3.9+Windows x86-64

rom_runtime-0.0.8-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.8-cp39-abi3-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

rom_runtime-0.0.8-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.8.tar.gz.

File metadata

  • Download URL: rom_runtime-0.0.8.tar.gz
  • Upload date:
  • Size: 139.9 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.8.tar.gz
Algorithm Hash digest
SHA256 9133e51f671f6ebce6f553ec4f99e340b9e681b1172d176dc1612bceb01ecda5
MD5 6f30546fcefa7049001a513a91f43ed9
BLAKE2b-256 d61321bd427e8a1ed35028b2b6a6aee964c8013e85132e1260324e6f20e5807d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.8.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.8-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: rom_runtime-0.0.8-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.8-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e4815338faaaa378aff7c46123443e233db4a26f31a21814e2524f1732e35da7
MD5 2f241299590a19d29e15b86591cb9699
BLAKE2b-256 31ec336189270f663d91fa340197dc80fc5b0be67715393347d1c8aada9d4f44

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.8-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.8-cp39-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.8-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 7430395c59dddb040dcf9d87312bb7e7abff7fdb579859fd503146d8744c37b4
MD5 733ac72d04259265507402f540cd99c2
BLAKE2b-256 9b2f84732adbf0444888fcab68e231f876afd2f701d69eecfb21d31a1add0222

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.8-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.8-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.8-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 54fc2f35864366e034dc43a7d616f9eb27e0f320e01ddbe3a6af6a4c13a87877
MD5 a6af5a56910495d0031fe5c234539ec7
BLAKE2b-256 b2ea7a570d154d4ec6ac8db64093b199516a4ccdfffa5fceeae17c55890a59f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.8-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.8-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rom_runtime-0.0.8-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c6e17b4abb760f0e0f202a6ef0c9b0e6c12a044d9d58ecc2db14e0fbd20b69c3
MD5 81ca5c78aeac27084ab7d228dc1a2e04
BLAKE2b-256 2db6a6f24c7046185c2b853e220a9b6b02ecced5849673a5a82aa55d4a0e8837

See more details on using hashes here.

Provenance

The following attestation bundles were made for rom_runtime-0.0.8-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