Skip to main content

fast5ever

WHATWG-compliant HTML parsing, mutation, and serialization for Python, powered by Rust's html5ever (the engine written for Servo).

html5ever uses the spec's algorithms but does not include the tree. fast5ever adds the missing piece, a fast arena DOM, and exposes both through a small Python API. Parsing, error recovery, and serialization all behave exactly as a browser's innerHTML does, because they are the same algorithms.

from fast5ever import parse, parse_fragment

frag = parse_fragment('<p>one<p>two')
frag.to_html()                        # '<p>one</p><p>two</p>'
[c.name for c in frag.children]       # ['p', 'p']

doc = parse('<!DOCTYPE html><title>t</title>hello')
doc.to_html()                         # '<!DOCTYPE html><html><head><title>t'...

API

  • parse(html) parses a complete document; parse_fragment(html, context='body') parses a fragment in a context element (pass e.g. context='tbody' to parse table rows). Both return the #document node.
  • Node is a lightweight handle: .name (tag, or #document/#text/#comment/#doctype), .attrs (dict snapshot in source order), .text (own content for text/comments), .children, .parent, to_html(), to_text().
  • Mutation: set_attr/del_attr/get_attr, append_child, insert_before(child, reference), replace_child(new, old), detach(). Inserting a #document node splices its children in (DocumentFragment semantics), so div.replace_child(parse_fragment(markup), old) splices markup in place. Inserting a node from another tree deep-copies it; handles stay valid across all mutations.

Serialization is the spec's

Output spelling comes from html5ever's own serializer - the WHATWG serialization algorithm, byte-for-byte what Chrome's innerHTML builds: boolean attributes as open="", double-quoted values, voids without /, raw text unescaped inside script/style. fast5ever adds no styling options and no compatibility shims with other serializers, by design.

Parsing is also bounded Chromium-style: element nesting beyond 512 flattens at the cap (Chromium's own limit), which keeps adversarially deep input linear-time - html5ever's tree builder alone is quadratic there.

Development

pip install -e .[dev]
maturin develop && pytest -q

All tests are pytest; cargo check/cargo clippy stay warning-free and need no Python (pyo3 sits behind the python feature).

Release

Release flow is: release first, then bump.

maturin develop && pytest -q
ship-rs-release
ship-bump

The GitHub workflow builds wheels on tags matching v* and publishes them to GitHub Releases and PyPI.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast5ever-0.1.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distributions

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

fast5ever-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (563.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

fast5ever-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (495.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

fast5ever-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (562.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

fast5ever-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (495.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

fast5ever-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (566.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

fast5ever-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (501.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

fast5ever-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (566.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

fast5ever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (501.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file fast5ever-0.1.0.tar.gz.

File metadata

  • Download URL: fast5ever-0.1.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fast5ever-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fc6c08b6531cb932fd0f7c04304d31e547319f701760df45fe0ba2d15ed285cb
MD5 36cb36df427b8d52b8b949457cd8272f
BLAKE2b-256 faba8f8bf727aad5997a38c03633f2e1594413911737d2769e841adc88becf48

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0.tar.gz:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c45b5b5631dd2ca4ca537342a3267f2f6472a13428bf03568e1d62e8492d2f52
MD5 534165db0ae2d6e236bf18b1e98ee560
BLAKE2b-256 72a3383ac74293786a841b670519f1f08b7d7f404dff7b71d275efd2a91684c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e80d4aa5c25a2c457ee52b00150af0db0fd885a218a45ba9b21a2cbbc037af1f
MD5 7ce1ccea494b2bcb04eb54958142b149
BLAKE2b-256 cb59d99ff979f16f4b87f971bc2d0b36067697dfce50642884604f88d2534609

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dbba7acb85c85622391aa4528d51ee5731c8d4a18db29f483204ec22405f7582
MD5 2f7ccab43b9721c5ad0e5aa340e48c2f
BLAKE2b-256 007b5ec5396c6fb1f5dae39444114605eac843fca145c1c1621b0739129be8c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4659e86dc325c870a9538942925851c0c73f7660fb1c07040713bede7f7f6f6b
MD5 951b10ef29bdc73b246bb0ce746134d8
BLAKE2b-256 0aa85036ea89e7248c460bb948f07ab6d7f33fad0467169008432aeac4c0bf7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 864fa92fd8cde0a59ec8721155840165f88a344abd5b1a185cdc9a0bd2791826
MD5 3da31eda31f353140ced76ba6f999501
BLAKE2b-256 dc7012fef75d39f216d560fa8bb279b3410b31095267f65d35c6ad939fc9fead

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d1fae5ebb75b96fd79c1a454336d271adc090ebc381be615016b3aecdddaa39f
MD5 66f8825b6d0022d1066f9f073fc13bb2
BLAKE2b-256 2d5773f77f5d0aeb381ab57d311cebd7da8cd502d9c3eaa34c9e0761ae8bec2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f8080e4228babb2e8fbf3f5556960ca015c7183730541b63e41102f061dba5de
MD5 3b2e4be7865a63ea336dd47a5abeb68c
BLAKE2b-256 c3e6352f5364104d95c83a8ab38d88ffd25beec1b15ba28f0c355e4e1cf2a5fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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

File details

Details for the file fast5ever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast5ever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 56b70538413fc1bc1ef3e3d0f7a7ec419df55cc04c4dc1957647dbd029a434e8
MD5 f14e36119d726fb9dc1905fef05b2bac
BLAKE2b-256 a845775ce2a9a0da9510d0e0c6226cea6dc8e21ce1c3b2c89246eb35b249c9d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast5ever-0.1.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: ci.yml on AnswerDotAI/fast5ever

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