Datagrunt 5.0.1: Faster Start-up
Datagrunt 5.0.1 makes import datagrunt and every PDF read start faster. No code changes are needed.
What changed
import datagrunt used to load the CSV, Excel and Parquet APIs and their libraries (Polars, DuckDB, PyArrow and the Excel engines), whether or not you used them. In 5.0.1, each API loads the first time one of its names is used:
from datagrunt import CSVReaderloads the CSV reader and writer.- The Excel, Parquet and PDF APIs stay unloaded until one of their names is used.
PDF reading benefits most. Every PDF is read in separate worker processes, and each worker imported the whole package as it started. Workers now load only what PDF extraction needs. Polars and PyArrow load only when a table becomes a data frame.
Measured on an Apple M5 Pro (median of 10 runs):
| 5.0.0 | 5.0.1 | |
|---|---|---|
import datagrunt |
143 ms | 28 ms |
| Reading a 1-page PDF | 180 ms | 86 ms |
| Reading a 5-page PDF | 237 ms | 148 ms |
Everything you import from datagrunt is the same object as before, and type checkers see the same names.
One thing to know: if the Rust extension Datagrunt needs is missing from your install, import datagrunt now succeeds. The ImportError naming it comes at your first CSV, Excel or Parquet use, not at import.
Upgrading
uv pip install --upgrade "datagrunt[pdf]"