Skip to main content

oxide_parse

PyPI CI MIT license

Declarative HTML and JSON extraction engine in Rust with a Python API: you describe a schema with T, compile it to a JSON-serializable IR, and run it in a single streaming pass or over a DOM.

Three things that set it apart:

  • Streaming engine (stream) without a DOM: common schemas (catalogs, metadata, embedded JSON) run in a single pass over bytes, keeping only the open tag stack and extracted values in memory.
  • Schema as serializable IR: save any plan to JSON or YAML (to_json()) and turn it back into plain Python (to_python()).
  • Zero-IO Session: the core never performs network requests or LLM calls — it yields URLs (follow, paginate) and broken selectors (adaptive + repair_batch) to your sync or async code.

Installation

pip install oxide-parse

From source (Rust 1.74+ and Python 3.9+):

uv sync && uv run maturin develop --release --features full

Quick Example

from oxide_parse import T, compile

html = """
<html><body>
  <h1>Laptops</h1>
  <script id="__NEXT_DATA__" type="application/json">{"currency": "USD"}</script>
  <div class="card"><h2>ThinkPad X1</h2><span class="price">$1,299.50</span></div>
  <div class="card"><h2>Broken</h2><span class="price">out of stock</span></div>
</body></html>
"""

schema = {
    "title": T.css("h1").text(),
    "currency": T.css("script#__NEXT_DATA__").text().parse_json()["currency"],
    "items": T.css(".card").map({
        "name": T.css("h2").text(),
        "price": T.css(".price").text().float(),
    }, on_error="skip"),
}

plan = compile(schema, backend="auto")
data = plan.extract_detailed(html)
print(plan.engine, data.data, data.errors, sep="\n")
stream
{'title': 'Laptops', 'currency': 'USD', 'items': [{'name': 'ThinkPad X1', 'price': 1299.5}]}
[{'path': '$.items[1].price', 'message': 'float: no number in "out of stock"'}]

Choosing an Engine

backend= Kind When to use DOM XPath :scope adaptive
auto automatic almost always (stream, falls back to DOM when needed) as needed yes yes yes
stream streaming catalogs, <head> metadata, large pages no no yes no
lite arena DOM complex CSS, :contains(), XPath, distill() yes yes yes yes
scraper html5ever DOM malformed HTML needing exact HTML5 tree rules yes yes no yes
json data same schemas over JSON documents no no no no
xml XML DOM XML documents and XPath selectors yes yes no no

Highlights

Hybrid HTML + JSON (__NEXT_DATA__, JS state, JSON-LD, OpenGraph):

hy_html = '<head><meta property="og:title" content="X1"></head><script id="s">window.__S__={"n":3}</script>'
hy_schema = {"og": T.meta_tags(values="first")["og:title"], "n": T.css("script#s").text().js_json("window.__S__")["n"]}
print(compile(hy_schema, backend="auto").extract(hy_html))
{'og': 'X1', 'n': 3}

Self-healing selectors & Python code patching (adaptive + extract_or_repair + to_python()):

p_adapt = compile({"price": T.css(".price", adaptive="price").text().float()})
p_adapt.extract('<div id="p1"><span class="price">$100</span></div>')
res = p_adapt.extract_or_repair('<section><div><strong class="cost">$95</strong></div></section>', repair=lambda _: {"price": ".cost"})
print(res.data, res.plan.to_python().splitlines()[-2].strip())
{'price': 95.0} 'price': T.css('.cost', adaptive='price').text().float(),

Zero-IO follow / paginate and Rayon extract_batch (GIL released):

from oxide_parse import follow, paginate

pages = {"https://ex.test/1": "<b>42</b><a class='next' href='/2'>n</a>", "https://ex.test/2": "<b>9</b>"}
f_plan = compile({"vals": follow(T.css("a").attr("href").url(), paginate(T.css("b").map(T.text().int()), T.css("a.next").attr("href").url()))})
print(f_plan.extract('<a href="/1">x</a>', meta={"base_url": "https://ex.test"}, fetch=lambda url, **_: pages[url]))
print(compile({"n": T.css("b").text().int()}, backend="auto").extract_batch(["<b>1</b>", "<b>x</b>"], errors="collect"))
{'vals': [42, 9]}
([{'n': 1}, None], [{'index': 1, 'message': 'extraction error at `$.n`: int: no number in "x"'}])

LLM preparation (distill, markdown) and deterministic migration without an LLM:

from oxide_parse import distill, markdown, migrate

print(markdown("<article><h1>Title</h1><p class='ad'>Ad</p><p>Text</p></article>", "article", without=".ad"))
print(migrate.from_selector_map_code({"title": "h1::text", "tags": ["li::text"]}).splitlines()[-3].strip())
# Title

Text
'title': T.css('h1').text().strip(),

Benchmarks

The author runs Criterion on Windows against saved HTML pages and synthetic catalogs. The report shows 95% confidence intervals and lists early exit as a separate workload. GitHub Actions measures Linux and macOS independently and attaches the data for regression review. Benchmark methodology and commands

Documentation

Section Links
Docs map docs/index.md
Guides Quickstart · DSL Cheatsheet · Choosing Engine · HTML + JSON · Adaptive & Repair · Follow & Pagination · RAG & Migration
AI prompts Generate Schema · Migrate Parser · Self-Healing Repair
Reference Python API · IR Specification · CSS & XPath · CLI
Core & tests Architecture · Conformance · Benchmarks · Publishing · CHANGELOG
LLM indexes llms.txt · llms-full.txt · CLAUDE.md

Report bugs in GitHub Issues. Use the security policy to report vulnerabilities privately.

Metadata

Release files for oxide-parse 9.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oxide-parse 9.1.1
File Size Uploaded Provenance Actions
oxide_parse-9.1.1.tar.gz 292.2 kB Without provenance Details for oxide_parse-9.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for oxide-parse 9.1.1
File Actions
oxide_parse-9.1.1-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for oxide_parse-9.1.1-cp310-abi3-win_arm64.whl
oxide_parse-9.1.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for oxide_parse-9.1.1-cp310-abi3-win_amd64.whl
oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_x86_64.whl
oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_aarch64.whl
oxide_parse-9.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for oxide_parse-9.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
oxide_parse-9.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for oxide_parse-9.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
oxide_parse-9.1.1-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for oxide_parse-9.1.1-cp310-abi3-macosx_11_0_arm64.whl
oxide_parse-9.1.1-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for oxide_parse-9.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 18.9 MB

Release files / oxide_parse-9.1.1.tar.gz

Download URL oxide_parse-9.1.1.tar.gz
Size 292.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3b967dd11432e578f4650574221bdd7b922bbf6794880b174db55b2051e0ea8d
BLAKE2b-256 checksum
How to use checksums
cc3b412d67e79fc31656c2cbaac4606c10caf6fadf73a8648833a6f51b9d16d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-win_arm64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-win_arm64.whl
Size 2.1 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
278a0af517b0ce1a0eebfa563c146ee87c6c17a8ee5013a9c794c4527ef230c0
BLAKE2b-256 checksum
How to use checksums
3a36b3fb54232f9582bf22d20849e22d1fce6be5ab361a3f881b4ec257ef5098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-win_amd64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-win_amd64.whl
Size 2.3 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
33258f1c2b5d31ad8353fa7498d92dd4eeb134215ec5d3acc6d2329e259162d9
BLAKE2b-256 checksum
How to use checksums
723903faa3ab9d83d8c0ff9df03d0172a885834809569276d402cf8afa1b4fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.6 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
a306e32b550b00193d3ab6dc670ffaa29578a16f80ac5e48198dee350c1a1f12
BLAKE2b-256 checksum
How to use checksums
1ced927de1270d6b8fd49d1e8eb2de9cc039c0740ee28afdea455e81a5a7eb15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-musllinux_1_2_aarch64.whl
Size 2.5 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
fbf545f4aaa67df4bcf95e0eee902c4376a70ef871ece18f3092fccb9ef3a294
BLAKE2b-256 checksum
How to use checksums
22fec86eb67085dff86ebe0a92e50fe6d7c5599c978f23a0f45c962eccc9e025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
150be132d520d17a5643ea87c5989113b5b92553e392fc18db19d719d457edd7
BLAKE2b-256 checksum
How to use checksums
2ed0412a1ef86343c752e0c5787ad2f2b20532760755429048dcdf15540d3c2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.3 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
aa3c1001f03996caacb1e49db2eb9d32ecd22d6440a444794f980b98aaa77f97
BLAKE2b-256 checksum
How to use checksums
f6d88e488fafb72a529f11bdde1f117be6a90ce5d2d5e9fd09111d9a8ef692bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-macosx_11_0_arm64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ad1cea41d54beab6c393d98f31f91b4defc8f18e6c5b8511afb063d646d8132b
BLAKE2b-256 checksum
How to use checksums
d30386d2568df33749135b5581f5b2cd118252f09837b8c2646f5677002fe58c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / oxide_parse-9.1.1-cp310-abi3-macosx_10_12_x86_64.whl

Download URL oxide_parse-9.1.1-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
234718b5ed982badbe1efb659986f1462b97361f1e9ab02a6b33f69bbaa70746
BLAKE2b-256 checksum
How to use checksums
7092040cb41086010863c7004e5096e8a62c8317e7215bda17fef955e50bf1c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for oxide-parse 9.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page