Skip to main content

damicore-normalizer

damicore-normalizer turns an input source into canonical objects, recording the size and SHA-256 of every one. Objects come from one of two sources: a dataset split by column or by row -- delimited text (.csv, .tsv, .txt) or an .xlsx/.xlsm worksheet -- or a set of files that already are the objects. It is the first stage of the DAMICORE pipeline; most users install the aggregate damicore distribution, which runs all four stages end to end. Install this package alone to materialize objects without the rest of the pipeline.

pip install damicore-normalizer

Python

from damicore_normalizer import (
    DelimitedSource,
    FileCorpusSource,
    NormalizationConfig,
    SpreadsheetSource,
    materialize_objects,
)

# Split a delimited file. Any single character is a delimiter, so a tab-separated
# `.txt` is this same source with `delimiter="\t"`.
result = materialize_objects(
    "dataset.csv",
    "normalization",
    config=NormalizationConfig(source=DelimitedSource(split="columns"), chunk_rows=50_000),
)

# Split a worksheet. `sheet` is required when the workbook holds more than one.
spreadsheet = materialize_objects(
    "dataset.xlsx",
    "normalization-xlsx",
    config=NormalizationConfig(source=SpreadsheetSource(split="columns")),
)

# Adopt files that already are the objects. No split, delimiter, or encoding.
corpus = materialize_objects(
    "corpus",
    "normalization-files",
    config=NormalizationConfig(source=FileCorpusSource(recursive=True)),
)

A delimited source streams one record at a time through Python's csv reader and a worksheet streams through openpyxl in read-only mode; both write the column files from a fixed 8 MiB buffer and never hold more than max_open_files of them open. A file corpus is copied in and hashed, so the run directory stays self-contained. Every source writes the objects plus a manifest.json into the output directory, and that manifest is the input the sibling damicore-distance distribution consumes to compute the NCD matrix.

The manifest records object_encoding -- json-lines/1 for a split dataset, raw-bytes/1 for adopted files -- because an NCD value is only meaningful relative to the bytes it measured.

Partitioning a dataset by a numeric column

To cluster the best and the worst segments of a population separately, split the dataset first. partition_dataset ranks the rows by one numeric column and writes, for each requested partition, the rows with the highest values and the rows with the lowest values as complete datasets, plus a partition.json recording what chose them.

from damicore_normalizer import partition_dataset

result = partition_dataset("population.csv", "segments", column="fitness")
for item in result.manifest.files:
    print(item.relative_path, item.row_count)

By default the halves, quarters, eighths, sixteenths and thirty-seconds (quantiles=(2, 4, 8, 16, 32)), the top and bottom 5, 10 and 20 percent of rows (percentiles=(5, 10, 20)), and Fisher-Jenks natural breaks into 2 to 5 classes (jenks_classes=(2, 3, 4, 5)) are emitted; pass an empty sequence to disable a method. Files are named {method}_{parameter:02d}_{high|low}.csv, hold the input's rows in input order with every cell unchanged, and are always ,-delimited UTF-8, so each one feeds materialize_objects or damicore.run with no further argument. A spreadsheet is partitioned the same way with source_kind="xlsx".

The decimal separator of the column is detected by testing . and , against every cell, or declared with decimal=; a column that fits neither is refused naming the offending rows, never guessed. Every rule the files depend on is versioned as partition_rule v1 and specified in the partitioning specification.

Licensed under Apache-2.0.

Metadata

Release files for damicore-normalizer 0.7.2

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

Source distribution (sdist)

Source distribution for damicore-normalizer 0.7.2
File Size Uploaded Provenance Actions
damicore_normalizer-0.7.2.tar.gz 40.5 kB With provenance Details for damicore_normalizer-0.7.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for damicore-normalizer 0.7.2
File Interpreter ABI Platform Actions
damicore_normalizer-0.7.2-py3-none-any.whl Python 3 none any Details for damicore_normalizer-0.7.2-py3-none-any.whl

Total release size: 88.0 kB

Release files / damicore_normalizer-0.7.2.tar.gz

Download URL damicore_normalizer-0.7.2.tar.gz
Size 40.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b212695ecb6c0c4ddb81928e8cf035d3d9a1fcf56a31153993e7e538fa69d1af
BLAKE2b-256 checksum
How to use checksums
3fca9d09833119fe00d6fa3aed0ddc89b8f7ea8810f32e382a61e0b23d763107
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 27, 2026.

Transparency log

Release files / damicore_normalizer-0.7.2-py3-none-any.whl

Download URL damicore_normalizer-0.7.2-py3-none-any.whl
Size 47.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a06ecb2e2e3fb8c1df03402461505f1e97cf047ef213eec485e46a036afc395
BLAKE2b-256 checksum
How to use checksums
ac57060fea7876f3f485fc67a1dbefecc960e3cb53a86330cd06767c0c0b3745
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 27, 2026.

Transparency log

Security for damicore-normalizer 0.7.2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for damicore_normalizer-0.7.2.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 27, 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