daft-html
A native Daft extension for HTML processing. Built on scraper / html5ever, so it handles real-world malformed HTML correctly.
Installation
pip install daft-html
Requires Python ≥ 3.10 and daft ≥ 0.4.
Quick start
import daft
import daft_html
from daft_html import html_to_text, html_get_title, html_extract_links
from daft import col
sess = daft.Session()
sess.load_extension(daft_html)
with sess:
df = daft.from_pydict({
"html": [
"<html><head><title>Hello</title></head><body><p>World</p></body></html>",
"<p>Just <b>text</b> here. <a href='https://example.com'>link</a></p>",
]
})
result = df.select(
html_to_text(col("html")).alias("text"),
html_get_title(col("html")).alias("title"),
html_extract_links(col("html")).alias("links"),
).collect()
# +-----------------+---------+---------------------------+
# | text | title | links |
# +-----------------+---------+---------------------------+
# | World | Hello | [] |
# | Just text here. | None | [https://example.com] |
# +-----------------+---------+---------------------------+
Operators
Document-level
| Function | Signature | Description |
|---|---|---|
html_to_text(expr) |
String → String | Extract plain text, discard all tags |
html_get_title(expr) |
String → String | Extract <title> text |
html_text_ratio(expr) |
String → Float64 | Ratio of visible text chars to raw HTML bytes |
html_extract_meta(expr, name) |
(String, str) → String | <meta name|property="…"> content value |
html_extract_links(expr) |
String → List[String] | All <a href="…"> URLs |
html_extract_tables(expr) |
String → List[String] | <table> elements as Markdown strings |
CSS-selector
| Function | Signature | Description |
|---|---|---|
html_extract_text(expr, selector) |
(String, str) → String | Inner text of first matching element |
html_get_attribute(expr, selector, attr) |
(String, str, str) → String | Attribute value of first matching element |
html_has_element(expr, selector) |
(String, str) → Bool | True if selector matches at least one element |
html_count_elements(expr, selector) |
(String, str) → Int64 | Count of elements matching selector |
Development
Requires uv and a Rust nightly toolchain (see rust-toolchain.toml).
make build # cargo build (debug) + pip install -e .
make test # pytest tests/ -v
License
Apache-2.0
Metadata
Release files for daft-html 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| daft_html-0.1.0.tar.gz | 29.2 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| daft_html-0.1.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details |
| daft_html-0.1.0-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details |
| daft_html-0.1.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| daft_html-0.1.0-py3-none-macosx_10_14_x86_64.whl | Python 3 | none | macOS 10.14+ x86-64 | Details |
Total release size: 4.0 MB
Release files / daft_html-0.1.0.tar.gz
| Download URL | daft_html-0.1.0.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb4ca4b07f12410d2e6a1e1bd5439c43d7cc994fc0c9025b85cf83777fb4c315
|
|
BLAKE2b-256 checksum How to use checksums |
db63f404500deb2115943f8d2840cd83a4760d39febd1933713ada11a718e3ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / daft_html-0.1.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | daft_html-0.1.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
f2b9a7cfbe0fca1f78dfbc236171b7e31fc94dff95e21c11de56e37c71232538
|
|
BLAKE2b-256 checksum How to use checksums |
0813343fd727dcd1fb8a7e8490ac4fa6008b9a58ee2c178d79c4adf097b296d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / daft_html-0.1.0-py3-none-manylinux_2_28_aarch64.whl
| Download URL | daft_html-0.1.0-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
806b5f409ec1bd4266cc9f9a14ee2aec1cd97d5a010546da1f6f0d423be17050
|
|
BLAKE2b-256 checksum How to use checksums |
dd5a110bbbbf050110692d76a2650554f87a7c9f35c6b3bdf271ff55028a7415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / daft_html-0.1.0-py3-none-macosx_11_0_arm64.whl
| Download URL | daft_html-0.1.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 853.8 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4347c431bf55dffb26334277ad4ed6a25017e942720cfc19be40c16cbaed0114
|
|
BLAKE2b-256 checksum How to use checksums |
19a55b096d4f2ed2cb046861e01b8d2da63a0f835a6f27d34846f6cb1d3d1ad4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency logRelease files / daft_html-0.1.0-py3-none-macosx_10_14_x86_64.whl
| Download URL | daft_html-0.1.0-py3-none-macosx_10_14_x86_64.whl |
|---|---|
| Size | 893.0 kB |
| Tags | Python 3 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
d14ceed582a4b47160611b57bd5fb95549ef2ff0a6c6fdce87d6705964c5ce23
|
|
BLAKE2b-256 checksum How to use checksums |
562361cca5829a6007fdfb1a2c12bceb4ad46f63b9617019eb1f89d97d2c1e42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 29, 2026.
Transparency log