Skip to main content

chooong.datasift

CI PyPI version Python versions License: Apache-2.0

Extract, validate and filter tables from XLSX/XLSM and CSV with a JSON mask. Rust streams rows and writes NDJSON/Parquet; Python exposes typed, immutable results. Automatic table discovery finds headers away from A1 and multiple table regions in Excel and CSV without fixed coordinates in the mask. Start with the discovery guide for Named-column and Free Discovery examples.

Installation

Requires CPython 3.12–3.14.

python -m pip install chooong.datasift

Compatible prebuilt wheels do not require a Rust compiler. Building from source requires Rust, Cargo and a native linker.

See the installation guide for details. Pydantic is the only direct Python runtime dependency; no external service is needed.

Features

Input formats

  • Read XLSX, XLSM and CSV files without loading entire worksheets into a DataFrame.
  • Process multiple files and wildcard paths in deterministic order.
  • Scan individual Excel worksheets or all worksheets in a workbook.
  • Configure CSV encodings, delimiters and quoting, including multiline fields.
  • Read cached Excel formula results without executing formulas or macros.

Table discovery

  • Automatically discover tables that do not start at A1.
  • Detect multiple tables within a worksheet, including adjacent and vertically separated tables.
  • Join a configured number of physical header rows, recognize repeated headers and optionally fill actual Excel merged ranges; discovery limits depend on the mode.
  • Normalize column names with trimming, case conversion, Unicode normalization, whitespace handling and aliases.
  • Resolve duplicate column names with deterministic suffixes.
  • Locate tables using header anchors independently of filter conditions.
  • Define explicit table sources with column mappings, row ranges and excluded rows.
  • Apply independent rules to different table sources.
  • Detect ambiguous layouts instead of silently guessing table boundaries.

Named-column Discovery uses anchors or filter column names, including for text-only data. Free Discovery needs scalar evidence immediately after each candidate header. Comments and totals require explicit row rules or predicates; their meaning is not inferred. CSV table discovery does not sniff delimiters or encodings.

Filtering and column selection

  • Define filters using JSON or typed Python models.
  • Combine conditions with AND, OR and NOT.
  • Compare values using equality, inequality, ordering and list membership.
  • Filter text using substring, prefix, suffix and regular-expression matching.
  • Check for empty values and specific data types.
  • Select output columns independently of filter conditions.
  • Select columns by name, wildcard or regular expression.
  • Control output column order without modifying the source.
  • Filter and select data directly in the native Rust engine.

Validation and data types

  • Enforce required fields and reject records with missing values.
  • Replace missing values with configurable defaults.
  • Validate column types and optionally convert values.
  • Support strings, integers, floats, booleans, Decimal, money, dates and datetimes.
  • Parse localized numeric and monetary values.
  • Preserve exact decimal and monetary values without implicit rounding.
  • Handle Excel date systems, ISO dates and timezone-aware datetimes.
  • Apply validation independently of output column selection.
  • Preserve original values and detailed rejection reasons for invalid records.

Row processing and streaming

  • Classify rows as data, headers, repeated headers, empty rows, comments, totals or separators.
  • Include or exclude row classes using configurable rules.
  • Stream results in bounded batches with backpressure.
  • Iterate over matching rows or receive matched and rejected records in a single ordered stream.
  • Return immutable, typed Python row objects.
  • Support early cancellation and explicit iterator cleanup.
  • Report row counts, conversions, defaults, rejections and discovered table schemas.

Export and reliability

  • Export matching and rejected records to NDJSON or Parquet.
  • Write output directly from Rust without Python-side row serialization.
  • Preserve source metadata in rejected NDJSON and both Parquet outputs; matched NDJSON contains projected values only. Rejected outputs also retain rejection details.
  • Preserve existing output files when scanning or serialization fails.
  • Use journaled commits and verified recovery for interrupted file replacements.
  • Continue processing independent tables after schema errors.
  • Optionally continue processing remaining input files after file errors while reporting incomplete results.
  • Enforce documented parser, schema, expression and resource limits.

Python API and CLI

  • Use the same filter configuration through Python and the command-line interface.
  • Validate JSON masks with Pydantic and generate JSON Schema.
  • Access matching rows, batches, detailed scan records and scan statistics.
  • Inspect discovered tables, column bindings and diagnostics.
  • Use CLI output files, stdout streaming and JSON execution reports.
  • Support CPython 3.12, 3.13 and 3.14 with a native Rust extension.

Example

This example creates its own input:

from pathlib import Path

from chooong.datasift import (
    AllOf,
    DataType,
    FilterMask,
    HeaderConfig,
    NumericCondition,
    Operator,
    ScalarCondition,
    TypeRule,
    iter_matching_rows,
)

Path("transactions.csv").write_text(
    "Country,Amount,Note\nDE,1500,first\nAT,2000,second\nDE,900,third\n",
    encoding="utf-8",
)

mask = FilterMask(
    sheet=None,
    header=HeaderConfig(anchors=("Country", "Amount")),
    types={"Amount": TypeRule(type=DataType.INTEGER, convert=True)},
    where=AllOf(conditions=(
        ScalarCondition(column="Country", op=Operator.EQ, value="DE"),
        NumericCondition(column="Amount", op=Operator.GTE, value=1000),
    )),
)

rows = [dict(row) for row in iter_matching_rows("transactions.csv", mask)]
assert rows == [{"Country": "DE", "Amount": 1500}]

Path("mask.json").write_text(
    mask.model_dump_json(by_alias=True),
    encoding="utf-8",
)

Run the same filter from the CLI:

chooong-datasift transactions.csv mask.json --output matches.ndjson

Column selection and validation

DataSift separates row filtering, column selection and validation. Use select to choose output columns, types to convert values and required to reject records with missing values.

from pathlib import Path

from chooong.datasift import (
    DataType,
    FilterMask,
    HeaderConfig,
    NumericCondition,
    Operator,
    TypeRule,
    iter_matching_rows,
)

Path("orders.csv").write_text(
    "Country,Amount,Reference\n"
    "DE,1500,INV-001\n"
    "DE,2200,\n"
    "AT,1900,INV-003\n"
    "DE,900,INV-004\n",
    encoding="utf-8",
)

mask = FilterMask(
    sheet=None,
    header=HeaderConfig(anchors=("Country", "Amount", "Reference")),
    select=("Reference", "Amount"),
    required=("Reference",),
    types={
        "Amount": TypeRule(type=DataType.INTEGER, convert=True),
    },
    where=NumericCondition(
        column="Amount",
        op=Operator.GTE,
        value=1000,
    ),
)

rows = [dict(row) for row in iter_matching_rows("orders.csv", mask)]

assert rows == [
    {"Reference": "INV-001", "Amount": 1500},
    {"Reference": "INV-003", "Amount": 1900},
]

The mask applies three independent operations:

  • Column selection: select returns only Reference and Amount, in that order. Country is excluded.
  • Type conversion: types converts CSV text in Amount to integers before numeric comparison.
  • Required fields: required rejects records where Reference is missing or empty.

The where condition matches amounts greater than or equal to 1000.

The record with amount 2200 is rejected because its reference is missing. The record with amount 900 does not match the filter. Neither appears in the matching results.

Rejected records remain available through scan_batches, including their original values and rejection reasons.

See the filter reference for the complete configuration and the validation guide for handling rejected records.

Documentation and limits

Start with installation and the quickstart. The documentation links guides, exact Python/CLI references and the filter schema. Practical workflows:

XLS/XLSB, encrypted workbooks, formula calculation and Excel output are unsupported. Formula caches are read. Shared strings and metadata use memory despite row streaming. Ambiguous layouts require anchors or explicit sources. A late scan failure may follow partial iterator/stdout results; exported results use a journaled commit, not a shared atomic two-file replacement. See file safety.

Public imports come from chooong.datasift. Python validates masks; the Rust core owns parsing and the row pipeline. For development, use uv sync --frozen and Contributing.

Changelog · Security · Apache-2.0 license · Support development

Metadata

Release files for chooong.datasift 0.1.0

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

Source distribution (sdist)

Source distribution for chooong.datasift 0.1.0
File Size Uploaded Provenance Actions
chooong_datasift-0.1.0.tar.gz 1.3 MB With provenance Details for chooong_datasift-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for chooong.datasift 0.1.0
File Actions
chooong_datasift-0.1.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for chooong_datasift-0.1.0-cp312-abi3-win_amd64.whl
chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl
chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl
chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl CPython 3.12 abi3 macOS 11.0+ x86-64 Details for chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl
chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 21.7 MB

Release files / chooong_datasift-0.1.0.tar.gz

Download URL chooong_datasift-0.1.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
1546089188ecd56a8b59eb5d9d4121fda8367c157a51d0df45a0e6f8fb783fd1
BLAKE2b-256 checksum
How to use checksums
e3da11378fdc54ef6e71365bb8de105690fca7f697fa5e83f54e230bbaee4af1
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 2, 2026.

Transparency log

Release files / chooong_datasift-0.1.0-cp312-abi3-win_amd64.whl

Download URL chooong_datasift-0.1.0-cp312-abi3-win_amd64.whl
Size 3.4 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2436b7b59ec652d0ca109fd856a242fe054f045c5805d65d43677310db884ef2
BLAKE2b-256 checksum
How to use checksums
eefd915ffa1ee2395d84fa4f81bb4a0b0386a3858a9c7840782a4841e946c25b
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 2, 2026.

Transparency log

Release files / chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_x86_64.whl
Size 5.0 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
aaae660cdd183b85a04becd09cc48ab391156d11e13ecdaad1266d6286565e7b
BLAKE2b-256 checksum
How to use checksums
e842fabb385884ecaf0a93cb6a55026c6f133697d3272a6530f51dbd01ebfa3e
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 2, 2026.

Transparency log

Release files / chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL chooong_datasift-0.1.0-cp312-abi3-manylinux_2_28_aarch64.whl
Size 5.0 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
bb5c8a6d52fcf6febf1132fedadbd19e877c22c79f78a5170948945566b283eb
BLAKE2b-256 checksum
How to use checksums
1dba091ceed6e293019fd7376484535c680084ab9f7e467e5f9feba1ef3d9ba1
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 2, 2026.

Transparency log

Release files / chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl

Download URL chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl
Size 3.6 MB
Tags CPython 3.12 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
58e86719fd1958ce3b73023c0c0dcab7018b5dc83a2c116b1695204a0575190d
BLAKE2b-256 checksum
How to use checksums
82d453ec2d7a3a9fc0d40d52de732518ea5f40e46cbba117a8a0b4da07a30ab1
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 2, 2026.

Transparency log

Release files / chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL chooong_datasift-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Size 3.5 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c20d376a773b883d1ba7cd6bd69ec6c98f7f42939484f2d3467f208b1e15703a
BLAKE2b-256 checksum
How to use checksums
e62b4d67a37351e642fe5b93b26f15b2e2ab18bb185a6e10fad323b59f9ed232
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 2, 2026.

Transparency log

Security for chooong.datasift 0.1.0

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 chooong_datasift-0.1.0.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 2, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

6 release files Full provenance

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