Skip to main content

datatrove-rs

PyPI Python versions CI License

Rust implementations of the slow steps in datatrove pipelines. Each one subclasses the datatrove step, takes the same arguments and produces the same output: keep/drop decisions, drop reasons, rewritten text, stats, and MinHash, sentence-dedup and Bloom filter files. Set DATATROVE_RS=1 and an unchanged pipeline uses them.

Wall time, LocalPipelineExecutor with 1 task. FineWeb recipe on 5,000 Common Crawl pages: datatrove 113.1 s, datatrove-rs 13.0 s (8.7x). FineWeb-2 German, quality filters and MinHash signatures on 4,000 documents: datatrove 32.4 s, datatrove-rs 0.97 s (33x). Output identical.

Installation

pip install "datatrove-rs[trafilatura]"

The [trafilatura] extra adds trafilatura-rs for the Trafilatura extractor, the most expensive step of the FineWeb recipe. Without it, every other step below is still accelerated.

Requires Python 3.10+ and datatrove >=0.10.1,<0.11. Wheels (abi3) are built for Linux x86_64/aarch64, macOS x86_64/arm64 and Windows x64.

Quickstart

DATATROVE_RS=1 python my_pipeline.py

Covered steps run in Rust; every other step runs datatrove's code. Executor workers inherit the variable, and pickled steps refer to the datatrove_rs classes, so local and Slurm workers get the same steps either way.

In code:

import datatrove_rs
datatrove_rs.patch()  # datatrove's own imports now return the Rust-backed steps

# or import from the mirror: any `datatrove.X` module is available as `datatrove_rs.X`
from datatrove_rs.pipeline.filters import GopherQualityFilter, URLFilter

python -m datatrove_rs my_pipeline.py runs a script with the patch applied.

What's covered

datatrove step English Other languages Notes
extractors.Trafilatura 9.8x step time inside the FineWeb recipe; needs the [trafilatura] extra
readers.WarcReader 2.2x #1 gzip WARCs; charset detection stays in Python
filters.URLFilter 7x #1 mostly blocklist loading and tldextract setup
filters.LanguageFilter 1.3x #1 the rest is fastText's own inference
filters.GopherRepetitionFilter 79x
filters.GopherQualityFilter 65x
filters.C4QualityFilter 58x
filters.FineWebQualityFilter 77x
the four filters, chained 68x de 53x #3, zh 33x, ja 4.5x #5, vi 31x, th 8.9x, hi 16x #6
dedup.MinhashDedupSignature 47x de 45x #3, zh 28x, ja 4.2x #5, vi 40x, th 5.3x, hi 5.7x #6 MinHash stage 1
dedup.MinhashDedupCluster 14-24x #2 MinHash stage 3, CPU time on 37M pairs; peak RSS 350 MB vs 829-1,015 MB
dedup.SentenceDedupSignature 69x de 52x, zh 24x, hi 4.1x #9 sentence dedup stage 1
dedup.SentenceDedupFilter 105x de 83x, zh 38x, hi 1.8x #9 sentence dedup stage 3
dedup.SingleBloomFilter 37x de 30x, zh 20x #8 step()
decont.NGramsDecontFilter 53x de 35x, zh 16x #8 NGramsDecontIndexer.compute_hashes too
filters.UnigramLogProbFilter 60x de 50x, zh 27x #8
formatters.PIIFormatter 16x #2 FineWeb-2 9x #2
formatters.FTFYFormatter 34x #2 FineWeb-2 25-74x, garbled docs 9-29x #11 ftfy.fix_text port for the default fixers
filters.C4BadWordsFilter 13x #2 FineWeb-2 13x #2
stats.WordStats 27x de 31x, zh 20x, hi 2.0x #7 full run(); datatrove 0.10.1 only
stats.SentenceStats 43x de 54x, zh 28x, hi 2.5x #7 datatrove 0.10.1 only
stats.DocStats 6x de 8x, zh 3.6x, hi 3.6x #7 datatrove 0.10.1 only
stats.LineStats, stats.ParagraphStats 2-3x 1.5-3.9x #7 mostly per-group bookkeeping; datatrove 0.10.1 only

Unmarked numbers were measured on 2026-11-13 with 0.1.5 (see Benchmarks below). Numbers marked with a pull request come from the results recorded in it: single-thread throughput on 500-1,000 FineWeb or FineWeb-2 documents, except WarcReader, URLFilter and LanguageFilter (CPU time on 5,000 Common Crawl records) and MinhashDedupCluster.

The steps that tokenize (filters, MinHash stage 1, stats, sentence dedup, Bloom, decontamination, unigram) run in Rust for:

  • the 57 languages spaCy tokenizes with rules (English, German, French, Spanish, Russian, Italian, Portuguese, Polish, Dutch, Turkish, Indonesian, 45 more, and the multi-language xx);
  • Chinese (jieba) and Japanese (SudachiPy);
  • Vietnamese (pyvi), Thai (pythainlp newmm words and crfcut sentences), and the 16 Indic NLP tokenizers datatrove uses for 129 language keys (Hindi, Bengali, Tamil, Urdu and more; Urdu sentences are urduhack's splitter).

What stays on datatrove's code

  • Korean (Kiwi), Stanza languages, and datatrove's whitespace, Burmese, Tibetan, Lao and Khmer tokenizers.
  • Urdu sentences without urduhack 1.0.2/1.0.3 importable (pip install urduhack gives 1.1.1, which can't be imported with numpy 2), and Urdu docs whose sentences datatrove can't locate in the text (it raises there).
  • FTFYFormatter with ligature, width, quote or line-break fixing or a normalization turned on (Rust then only skips ftfy where it provably changes nothing), or ftfy other than 6.3.1.
  • Any step whose dependency is at an unverified version (see below), a subclass that overrides a reproduced method, a document with lone surrogates, and options outside the reproduced set (Trafilatura options trafilatura-rs doesn't support, non-default PII patterns, URLFilter without the integrated lists, and so on).

The fallback is per language, per document or per step, decided at run time. The full list, per step, is in docs/parity.md.

Exactness and version guards

Each step is checked against unmodified datatrove in the same environment: per-document results, rewritten text, run() stats, exclusion-writer documents and output files, compared byte for byte on real FineWeb and FineWeb-2 documents plus perturbed and fuzzed ones in every covered language. Both pipelines in the chart give identical output. Corpora, configurations and results: docs/parity.md.

Where output depends on another library's version, the installed version is checked at run time, and on a mismatch the affected step or language runs datatrove's code:

Dependency Rust path only when
datatrove 0.10.1 for the stats steps; sentence dedup checks a fingerprint of the datatrove methods it reproduces
spaCy 3.8.2-3.8.11 or 3.8.13-3.8.18 (their tokenizer rules are identical to the shipped ones), or not installed
jieba 0.42.1
SudachiPy 0.7.0 with SudachiDict-core installed
pyvi, pythainlp, indic-nlp-library 0.1.1, 5.4.0, 0.92, or not installed
python-crfsuite 0.9.12 with pythainlp 5.4.0, for Thai sentences (otherwise only they run datatrove's code)
urduhack 1.0.2 or 1.0.3, importable (it needs TensorFlow), for Urdu sentences (otherwise only they run datatrove's code)
trafilatura, lxml a pair trafilatura-rs reproduces
tldextract 5.4.x (otherwise only the host split goes through tldextract)
ftfy 6.3.1 for the fix_text port; other 6.x only skips ftfy on unchanged docs; otherwise ftfy always runs

One thing is not checked: the Unicode tables come from Python 3.13 (Unicode 15.1); on another Unicode version the package warns on import, since results could differ on rare characters.

Benchmarks

The chart comes from tools/recipe_bench.py, which runs each pipeline through LocalPipelineExecutor (1 task), alternating datatrove and datatrove-rs runs and comparing output digests. tools/make_chart.py draws it from the raw runs in docs/assets/fineweb-speed.json. The 2026-11-13 runs were on a shared 16-CPU machine at load average 8-36. Each run is single-threaded, its CPU time is within 4% of its wall time, and no run was memory-throttled.

The per-step table comes from tools/bench.py (single thread, the step alone on the same documents, median of 3). Per-language tables and older profiling are in docs/fineweb-profile.md and the linked pull requests.

Contributing

Development setup, the parity harness, benchmarks and releasing: CONTRIBUTING.md.

License

Apache-2.0, like datatrove. datatrove-rs is an independent project and is not affiliated with Hugging Face.

Metadata

Release files for datatrove-rs 0.1.7

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

Source distribution (sdist)

Source distribution for datatrove-rs 0.1.7
File Size Uploaded Provenance Actions
datatrove_rs-0.1.7.tar.gz 1.5 MB With provenance Details for datatrove_rs-0.1.7.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for datatrove-rs 0.1.7
File Actions
datatrove_rs-0.1.7-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for datatrove_rs-0.1.7-cp310-abi3-win_amd64.whl
datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_x86_64.whl
datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_aarch64.whl
datatrove_rs-0.1.7-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for datatrove_rs-0.1.7-cp310-abi3-macosx_11_0_arm64.whl
datatrove_rs-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for datatrove_rs-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 23.3 MB

Release files / datatrove_rs-0.1.7.tar.gz

Download URL datatrove_rs-0.1.7.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
ef301d57290c05760da1fbed399c2cd58c1052e1f223043af5183d26cd3d7885
BLAKE2b-256 checksum
How to use checksums
50a96d511b092be9d94bc5c3b0da00c41481023c092830fdf04ab1da9cd83ddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / datatrove_rs-0.1.7-cp310-abi3-win_amd64.whl

Download URL datatrove_rs-0.1.7-cp310-abi3-win_amd64.whl
Size 4.4 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b12b366131914e6bfc1a048a2a651c9a0f4380e31a2a5dfd0c37ff60739ca082
BLAKE2b-256 checksum
How to use checksums
13a78889b8f2576b0ad6fa4f896e7e98600261131c915428d69685c7878859ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_x86_64.whl
Size 4.4 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
486e699544c5c9e71cc844b5503f2dd6708e891598555e07d232caa2e4f79844
BLAKE2b-256 checksum
How to use checksums
103bbd919d8a9b0169184cf74c0e8646f3239c19baeec8c4f351ae88c5e47dbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL datatrove_rs-0.1.7-cp310-abi3-manylinux_2_28_aarch64.whl
Size 4.3 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
dec711472613daf52da33ac2b3def25a5293a586ffe4f126678eda0c928e9ea3
BLAKE2b-256 checksum
How to use checksums
bed7a2efa13e1df0cfcb96bcf61f72ac3bec68595f77a13155d110ee05750356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / datatrove_rs-0.1.7-cp310-abi3-macosx_11_0_arm64.whl

Download URL datatrove_rs-0.1.7-cp310-abi3-macosx_11_0_arm64.whl
Size 4.4 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bfaa0022f05962115bc5a6d3f208d12a7b64b2e06c603f21a414494d601db1d6
BLAKE2b-256 checksum
How to use checksums
e28225cb80a8d61088980b096a4b2ee6c2e32d1f7e35e6f9c1d5f5a966a73da0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Release files / datatrove_rs-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl

Download URL datatrove_rs-0.1.7-cp310-abi3-macosx_10_12_x86_64.whl
Size 4.3 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
832b21c843de6656954330de7c5f723c9d5357784e001d1c09b5ba3f2e033b0d
BLAKE2b-256 checksum
How to use checksums
1deb5cddf5d0ee3f23448a0dd380d4c86b782c7e7a79dd3e00859be378668571
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 17, 2026.

Transparency log

Security for datatrove-rs 0.1.7

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for datatrove_rs-0.1.7.tar.gz

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 Nov 17, 2026.

Transparency log

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