dataset-fingerprint 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. dataset_fingerprint-0.1.0/LICENSE +202 -0
  2. dataset_fingerprint-0.1.0/NOTICE +5 -0
  3. dataset_fingerprint-0.1.0/PKG-INFO +331 -0
  4. dataset_fingerprint-0.1.0/README.md +267 -0
  5. dataset_fingerprint-0.1.0/pyproject.toml +99 -0
  6. dataset_fingerprint-0.1.0/setup.cfg +4 -0
  7. dataset_fingerprint-0.1.0/src/dataset_fingerprint/__init__.py +39 -0
  8. dataset_fingerprint-0.1.0/src/dataset_fingerprint/__main__.py +5 -0
  9. dataset_fingerprint-0.1.0/src/dataset_fingerprint/cli.py +306 -0
  10. dataset_fingerprint-0.1.0/src/dataset_fingerprint/diff.py +156 -0
  11. dataset_fingerprint-0.1.0/src/dataset_fingerprint/hashing.py +91 -0
  12. dataset_fingerprint-0.1.0/src/dataset_fingerprint/ledger.py +1634 -0
  13. dataset_fingerprint-0.1.0/src/dataset_fingerprint/modality.py +124 -0
  14. dataset_fingerprint-0.1.0/src/dataset_fingerprint/perceptual.py +143 -0
  15. dataset_fingerprint-0.1.0/src/dataset_fingerprint/probe.py +270 -0
  16. dataset_fingerprint-0.1.0/src/dataset_fingerprint/py.typed +0 -0
  17. dataset_fingerprint-0.1.0/src/dataset_fingerprint/splits.py +438 -0
  18. dataset_fingerprint-0.1.0/src/dataset_fingerprint/storage.py +320 -0
  19. dataset_fingerprint-0.1.0/src/dataset_fingerprint.egg-info/PKG-INFO +331 -0
  20. dataset_fingerprint-0.1.0/src/dataset_fingerprint.egg-info/SOURCES.txt +25 -0
  21. dataset_fingerprint-0.1.0/src/dataset_fingerprint.egg-info/dependency_links.txt +1 -0
  22. dataset_fingerprint-0.1.0/src/dataset_fingerprint.egg-info/entry_points.txt +3 -0
  23. dataset_fingerprint-0.1.0/src/dataset_fingerprint.egg-info/requires.txt +52 -0
  24. dataset_fingerprint-0.1.0/src/dataset_fingerprint.egg-info/top_level.txt +1 -0
  25. dataset_fingerprint-0.1.0/tests/test_leak_rate.py +92 -0
  26. dataset_fingerprint-0.1.0/tests/test_mlfingerprint.py +546 -0
  27. dataset_fingerprint-0.1.0/tests/test_near_duplicates.py +126 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ dataset-fingerprint
2
+ Copyright 2026 Raj Alamuri
3
+
4
+ This product includes software developed by Raj Alamuri
5
+ (https://github.com/rajanalamuri/dataset-fingerprint).
@@ -0,0 +1,331 @@
1
+ Metadata-Version: 2.4
2
+ Name: dataset-fingerprint
3
+ Version: 0.1.0
4
+ Summary: A lockfile for training data: manifest-based dataset versioning, lineage and leakage checks for any modality (vision, audio, sensors, NLP, time series) on any storage (local, S3, Azure, GCS, Databricks).
5
+ Author: Raj Alamuri
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/rajanalamuri/dataset-fingerprint
8
+ Project-URL: Issues, https://github.com/rajanalamuri/dataset-fingerprint/issues
9
+ Keywords: fingerprint,data lineage,leakage,time series,computer vision,nlp,mlops,data versioning,dataset,reproducibility,manifest,lineage,machine learning,s3,databricks,azure
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Classifier: Topic :: Software Development :: Version Control
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Provides-Extra: s3
24
+ Requires-Dist: fsspec>=2023.1; extra == "s3"
25
+ Requires-Dist: s3fs>=2023.1; extra == "s3"
26
+ Provides-Extra: gcs
27
+ Requires-Dist: fsspec>=2023.1; extra == "gcs"
28
+ Requires-Dist: gcsfs>=2023.1; extra == "gcs"
29
+ Provides-Extra: azure
30
+ Requires-Dist: fsspec>=2023.1; extra == "azure"
31
+ Requires-Dist: adlfs>=2023.1; extra == "azure"
32
+ Provides-Extra: databricks
33
+ Requires-Dist: fsspec>=2023.1; extra == "databricks"
34
+ Requires-Dist: requests>=2.25; extra == "databricks"
35
+ Provides-Extra: hf
36
+ Requires-Dist: fsspec>=2023.1; extra == "hf"
37
+ Requires-Dist: huggingface_hub>=0.20; extra == "hf"
38
+ Provides-Extra: cloud
39
+ Requires-Dist: dataset-fingerprint[azure,databricks,gcs,hf,s3]; extra == "cloud"
40
+ Provides-Extra: image
41
+ Requires-Dist: Pillow>=9.1; extra == "image"
42
+ Provides-Extra: all
43
+ Requires-Dist: dataset-fingerprint[cloud,image]; extra == "all"
44
+ Provides-Extra: test
45
+ Requires-Dist: pytest>=7; extra == "test"
46
+ Requires-Dist: pytest-cov>=4; extra == "test"
47
+ Requires-Dist: Pillow>=9.1; extra == "test"
48
+ Provides-Extra: integration
49
+ Requires-Dist: dataset-fingerprint[azure,gcs,test]; extra == "integration"
50
+ Requires-Dist: s3fs>=2023.1; extra == "integration"
51
+ Requires-Dist: moto[server]>=5; extra == "integration"
52
+ Requires-Dist: pytest-timeout>=2; extra == "integration"
53
+ Provides-Extra: security
54
+ Requires-Dist: bandit[toml]>=1.7; extra == "security"
55
+ Requires-Dist: pip-audit>=2.7; extra == "security"
56
+ Provides-Extra: dev
57
+ Requires-Dist: dataset-fingerprint[integration,security,test]; extra == "dev"
58
+ Requires-Dist: build; extra == "dev"
59
+ Requires-Dist: twine; extra == "dev"
60
+ Requires-Dist: ruff; extra == "dev"
61
+ Requires-Dist: mypy; extra == "dev"
62
+ Requires-Dist: pre-commit; extra == "dev"
63
+ Dynamic: license-file
64
+
65
+ <p align="center">
66
+ <picture>
67
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/hero-dark.svg">
68
+ <img src="docs/assets/hero-light.svg" alt="dataset-fingerprint: a lockfile for your training data" width="100%">
69
+ </picture>
70
+ </p>
71
+
72
+ <p align="center">
73
+ <a href="https://github.com/rajanalamuri/dataset-fingerprint/actions/workflows/ci.yml"><img src="https://github.com/rajanalamuri/dataset-fingerprint/actions/workflows/ci.yml/badge.svg" alt="ci"></a>
74
+ <a href="https://github.com/rajanalamuri/dataset-fingerprint/actions/workflows/security.yml"><img src="https://github.com/rajanalamuri/dataset-fingerprint/actions/workflows/security.yml/badge.svg" alt="security"></a>
75
+ <img src="https://img.shields.io/badge/python-3.9%E2%80%933.13-101418" alt="python 3.9-3.13">
76
+ <img src="https://img.shields.io/badge/dependencies-zero-ffd84a" alt="zero dependencies">
77
+ <img src="https://img.shields.io/badge/license-Apache%202.0-101418" alt="Apache 2.0">
78
+ </p>
79
+
80
+ # dataset-fingerprint
81
+
82
+ **A lockfile for your training data.** Every dataset version gets a fingerprint: a manifest describing exactly which bytes were in it, how it was split, where it came from, and which models were trained on it. It works for any modality (video, frames, audio, images, radar, lidar, IMU, text, tabular, time series) on any storage (local, S3, Azure, GCS, Databricks, HDFS, HF…).
83
+
84
+ ```bash
85
+ pip install dataset-fingerprint # zero dependencies: local disks, Databricks /Volumes + /dbfs
86
+ pip install "dataset-fingerprint[s3]" # + S3 / MinIO / R2 [azure] [gcs] [databricks] [hf] [cloud] [all]
87
+ ```
88
+
89
+ ```python
90
+ import dataset_fingerprint as fp
91
+
92
+ v = fp.commit("s3://raw/drives", "s3://ml/ledgers/drives", message="added 3 batches") # version
93
+ ds = fp.load("s3://ml/ledgers/drives", "prod") # retrieve (tag or 1.2.0)
94
+ ds.files("train"); ds.samples("val"); ds.to_torch("train", loader) # use
95
+ fp.record_training("model-v1", [ds], {"acc": 0.94}, recipe={"hflip": 0.5}, seed=42) # trace
96
+ ```
97
+
98
+ No server, no database, no account. A version is a folder of small files next to your data.
99
+
100
+ ---
101
+
102
+ ## The idea
103
+
104
+ <picture>
105
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/concept-dark.svg">
106
+ <img src="docs/assets/concept-light.svg" alt="How it works: every file is hashed into an index, whole recordings are assigned to one split, a small manifest with a single fingerprint is sealed, the model stores that fingerprint, and verify names the exact file that changed later." width="100%">
107
+ </picture>
108
+
109
+ **Version the description, not the data.** Blobs stay where they are. Each version is an immutable folder:
110
+
111
+ ```
112
+ <ledger root>/ local · s3:// · az:// · abfss:// · gs:// · dbfs:/ · /Volumes/… · hdfs:// · hf://
113
+ ├── ledger.json tags.json
114
+ ├── objects/ab/cdef….png ← only in mode="cas" (deduplicated across versions)
115
+ ├── drives-v1.0.0/
116
+ │ ├── manifest.json ← the contract: fingerprint, split checksums, lineage, parents, stats, quality
117
+ │ ├── index.jsonl.gz ← one row per file: path, split, label, size, sha256, modality, sensor meta
118
+ │ ├── splits/train.txt ← ready-made file lists (absolute URIs)
119
+ │ └── usage.jsonl ← every model trained on it (metrics, recipe, seed)
120
+ └── drives-v1.1.0/ …
121
+ ```
122
+
123
+ - **Fingerprint** = a hash over every file's path, split and SHA-256. If any byte, file, rename or split assignment changes, the fingerprint changes.
124
+ - **Retrieval** = read one manifest, read one index, then stream files straight from storage into your loader.
125
+ - **Traceability** = models store `ds.lock()` (version + fingerprint + split checksums + manifest URI). `fp.load_lock(lock)` reopens the exact data later, and refuses if the ledger was altered.
126
+
127
+ | Mode | Data | When |
128
+ |---|---|---|
129
+ | `reference` (default) | stays in place, zero copy; `verify()` detects drift | write-once raw prefixes (best with S3 Object Lock / bucket versioning) |
130
+ | `cas` | content-addressed snapshot; identical files stored once across all versions | sources that change in place |
131
+ | `copy` / `hardlink` | per-version snapshot | small datasets, local disks |
132
+
133
+ ## Works for every ML task
134
+
135
+ | Task | Layout it understands | What it guarantees |
136
+ |---|---|---|
137
+ | **Classification** | `train/cat/1.jpg`, `0/…9/` | labels + class balance per split |
138
+ | **Detection / segmentation** | `images/x.jpg` + `labels/x.txt` / `masks/x.png`; COCO `instances_train2017.json`, `train2017/` | image and annotation always in the same split; `label_format="yolo"` reports objects per class per split |
139
+ | **Video / frames** | `seq_014/frame_000123.png` (video divided at a fixed fps) | a sequence never straddles splits; frame counts per sequence |
140
+ | **Multi-sensor** (AV, robotics, wearables) | `drive_03/{camera,radar,imu,lidar,gnss,can,mic}/…` | a recording stays in one split; sensors stay time-synced |
141
+ | **Audio / speech** | `speaker_07/utt_3.wav`, `train/…` | duration, sample rate; `group_by="parent"` keeps a speaker in one split |
142
+ | **NLP** | `train.jsonl`, `dev.csv`, HF `test-0001-of-0004.parquet` | record-level label balance; **flags the same sentence in train and test** |
143
+ | **Time-series forecasting** | `2026-05-08/imu.csv`, epoch filenames, timestamp columns | `split="temporal"`: past → train, future → test; overlap check; row-level cutoffs for one long series |
144
+ | **Tabular** | csv / parquet | rows, columns, record overlap |
145
+
146
+ Sensor folders set the modality even for generic files (`radar_front/0001.bin` → radar, `imu0/data.npy` → imu). Add your own with `fp.register_sensor("sonar", "sonar", "sss")`, `fp.register_rule("radar", "*.rdc")` or `--modality radar='*/mmwave/**'`.
147
+
148
+ ## Leakage checks (built in, on every commit)
149
+
150
+ | Check | Catches |
151
+ |---|---|
152
+ | auto grouping (`group_by="auto"`) | frames, recordings, sensor streams, image+label pairs, augmented copies, takes/parts of one source clip split apart |
153
+ | augmentation detection (`img_001_hflip.png`, `utt3_speed1.1.wav`, `aug/`, `synthetic/`) | an augmented copy in a different split than its original; augmented data in val/test |
154
+ | exact duplicates | the same file content in two splits |
155
+ | near-duplicates (`near_duplicates=True`, needs Pillow) | the same picture re-encoded, resized or colour-shifted in two splits (64-bit dHash, exact Hamming search) |
156
+ | record overlap (text/csv/jsonl) | the same normalised sentence/row in train and val/test |
157
+ | parent check (derived datasets) | training files copied or augmented from a parent's val/test split |
158
+ | temporal check | training window overlapping the test period |
159
+ | split drift (diff) | files that moved split between versions (e.g. test → train) |
160
+
161
+ Warnings are logged and stored in `manifest.quality` and `manifest.lineage.warnings`. Set `augmentation="error"` to fail CI on augmentation leaks.
162
+
163
+ ### Leak rate and effective test size
164
+
165
+ Every commit reports one number you can check by hand:
166
+
167
+ ```
168
+ leak rate : 1.00% test 100/10,000 (effective 9,900)
169
+ suspected : 1.00% incl. near-duplicates
170
+ ```
171
+
172
+ **Leak rate** = val/test files that are byte copies of a train file, augmentations of the same file, or overlap train
173
+ in time ÷ all val/test files. Each leaked file is listed in the manifest (`quality.leakage`), by split and by reason.
174
+ **Effective size** is the test set left once they are removed. **Suspected rate** adds perceptual near-duplicates,
175
+ which are likely but not proven. Text and tables also get a record-level rate (rows/sentences also in train).
176
+
177
+ Fail CI above a threshold:
178
+
179
+ ```bash
180
+ fingerprint commit ./data --near-dups --max-leak-rate 0.5%
181
+ ```
182
+
183
+ ## Data added, derived and augmented
184
+
185
+ ```python
186
+ raw = lg.commit("s3://raw/drives", message="batch 05-10") # 1.1.0 → 1.2.0 automatically
187
+
188
+ # offline augmentation / filtering / relabelling = a derived dataset with parents
189
+ aug = fp.commit("s3://aug/drives", "s3://ml/ledgers/drives-aug",
190
+ parents=[raw, {"type": "delta", "table": "main.ml.labels", "version": 42}],
191
+ transformations=[{"name": "hflip"}, {"name": "rain", "p": 0.3}])
192
+ aug.trace() # full ancestry tree
193
+ aug.check_lineage() # ["stale: derived from drives-v1.2.0, parent now at drives-v1.3.0"]
194
+
195
+ # on-the-fly augmentation isn't in the data, so it goes in the training record
196
+ fp.record_training("model-v4", [raw, aug, text_ds], {"mAP": 0.61},
197
+ recipe={"random_crop": 0.5, "specaugment": True}, seed=1234)
198
+ ```
199
+
200
+ **Automatic semantic versions** (`bump="auto"`):
201
+
202
+ | Change | Version bump |
203
+ |---|---|
204
+ | new modality/sensor | major |
205
+ | files added | minor |
206
+ | removals/fixes | patch |
207
+ | nothing changed | no new version (CI-safe) |
208
+
209
+ **Tags**: `lg.tag("1.2.0", "prod")` → `fp.load(root, "prod")`, with tag history kept.
210
+
211
+ ## Time-series forecasting
212
+
213
+ ```python
214
+ fp.commit("s3://iot/load", L, split="temporal", probe=True) # 80/10/10 by time
215
+ fp.commit("s3://iot/load", L, time_cutoffs={"val": "2026-05-01", "test": "2026-05-15"})
216
+ fp.commit("./one_series", L, split="none", # one long CSV
217
+ row_split={"column": "timestamp", "val_from": "2026-05-01", "test_from": "2026-05-15"})
218
+ ds.split_for_time(row["timestamp"]) # -> 'train' | 'val' | 'test' inside your loader
219
+ ```
220
+
221
+ Time comes from timestamp columns (`--probe`; ns/µs/ms/s epochs or ISO), dates or epochs in paths, or local mtimes.
222
+
223
+ ## CLI
224
+
225
+ <picture>
226
+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/cli-dark.svg">
227
+ <img src="docs/assets/cli-light.svg" alt="Terminal demo: install, commit an S3 dataset, tag it prod, verify catches a modified file" width="100%">
228
+ </picture>
229
+
230
+ ```bash
231
+ export FINGERPRINT_ROOT=s3://ml/ledgers/drives
232
+ fingerprint commit s3://raw/drives -n drives -m "batch 05-10" -t "dropped frames with gaps > 5s" --probe
233
+ fingerprint commit s3://aug/drives -L s3://ml/ledgers/drives-aug --parent s3://ml/ledgers/drives@1.2.0
234
+ fingerprint log | show prod | diff 1.1.0 1.2.0 | lineage | tags
235
+ fingerprint tag prod 1.2.0 -m "shipped with model-v4"
236
+ fingerprint verify prod --sample 0.05 # exit 1 on failure → CI gate (--quick: size only)
237
+ fingerprint checkout prod ./data --split val --mode hardlink
238
+ fingerprint files prod --split train > train.txt
239
+ fingerprint lock prod # JSON to store with the model
240
+ ```
241
+
242
+ ## Integrations
243
+
244
+ - **PyTorch**: `ds.to_torch("train", loader=lambda f, rec: decode(f.read()))`
245
+ - **MLflow**: `ds.log_mlflow()` logs tags plus `dataset_lock.json`
246
+ - **Feature stores / W&B / anything**: `ds.tags_dict()` gives `{dataset, dataset_version, dataset_fingerprint}`. Write it into feature-table properties so features trace back to raw data.
247
+ - **CI**: `commit` is idempotent; `verify` exits non-zero; commits are protected against two jobs writing the same version.
248
+
249
+ ## Storage
250
+
251
+ | URI | Extra | Notes |
252
+ |---|---|---|
253
+ | `/path`, `/Volumes/…`, `/dbfs/…` | – | local + Databricks clusters |
254
+ | `dbfs:/…` | `databricks` | FUSE on-cluster, REST off-cluster (`DATABRICKS_HOST`, `DATABRICKS_TOKEN`) |
255
+ | `s3://` | `s3` | `AWS_ENDPOINT_URL` for MinIO / R2 / Ceph |
256
+ | `az://`, `abfs://`, `abfss://` | `azure` | `storage_options={"account_name": …}` or a connection string |
257
+ | `gs://` | `gcs` | |
258
+ | `hf://`, `hdfs://`, `sftp://`, … | `hf` / any fsspec driver | |
259
+
260
+ Source and ledger can be on different clouds. Big buckets are listed in parallel per prefix, and re-commits only re-hash files whose ETag/mtime changed.
261
+
262
+ ## Where it fits
263
+
264
+ Upstream of a feature store, alongside your experiment tracker. If you outgrow it (hundreds of interdependent versions, collaborative labelling), the manifests remain plain JSON you can migrate.
265
+
266
+ ## Benchmarks
267
+
268
+ Run on **MNIST**, **Fashion-MNIST** (70,000 images each), **CIFAR-10**, **UCI HAR**, **ESC-50**, four text benchmarks and the full **COCO 2017** annotation set (122,224 files,
269
+ 886,282 objects) plus real COCO images. Every number is cross-checked against ground truth computed independently
270
+ of dataset-fingerprint. Full report and how to reproduce it: [benchmarks/RESULTS.md](benchmarks/RESULTS.md).
271
+
272
+ | 70,000 files, 2 vCPUs | MNIST | Fashion-MNIST |
273
+ |---|---:|---:|
274
+ | First commit | 23.3 s | 22.9 s |
275
+ | Re-commit, nothing changed | 8.1 s | 7.2 s |
276
+ | `verify` full re-hash / 5 % sample | 5.7 s / 0.24 s | 5.5 s / 0.38 s |
277
+ | One-pixel edit caught · augmentation leak flagged | ✅ · ✅ | ✅ · ✅ |
278
+ | Exact train/test duplicates found (= ground truth) | 0 | 0 |
279
+
280
+ | COCO 2017 annotations, 122,224 files | |
281
+ |---|---:|
282
+ | First commit (hash + count 886k objects by class) / re-commit, no change | 35.1 s / 23.4 s |
283
+ | `verify` full / 5 % sample | 9.9 s / 0.88 s |
284
+ | Val objects vs official `instances_val2017.json` (non-crowd) | 36,335 = 36,335 ✅ |
285
+ | Edited box caught · copied val label in train flagged · image+label pairs kept together | ✅ · ✅ · ✅ |
286
+
287
+ | CIFAR-10 near-duplicates (`near_duplicates=4`), vs the ciFAIR list | |
288
+ |---|---:|
289
+ | Test images flagged / in ciFAIR's list / confirmed by eye but missing from it | 91 / 63 / 24 |
290
+ | Flags that are real train/test leaks | 87 / 91 (96 %) |
291
+ | Recall of ciFAIR's 286 (CNN + manual review) | 22 % at ≤ 4 · 54 % at ≤ 8 |
292
+ | Commit of 60,000 PNGs without / with the check / warm re-commit | 7.5 s / 35.8 s / 10.6 s |
293
+
294
+ | Leak rate | MNIST | Fashion | CIFAR-10 |
295
+ |---|---:|---:|---:|
296
+ | As published (confirmed) | 0.00 % | 0.00 % | 0.00 % (0.91 % suspected, 0.87 % confirmed by eye) |
297
+ | With 100 planted leaks (50 copies, 50 flips) | 1.00 % ✅ | 1.00 % ✅ | |
298
+
299
+ ### Does it matter? What the leaks it targets cost
300
+
301
+ | Data | Leaky split | Clean split | |
302
+ |---|---:|---:|---|
303
+ | UCI HAR sensors, random forest | 97.7 % (random windows) | 93.2 % (by subject) | 3× fewer errors reported |
304
+ | ESC-50 audio, logistic regression | 63.8 % (random files) | 54.7 % (by source clip) | +9 points; 4 sources also straddle the official folds |
305
+ | CIFAR-10, 310 duplicated test images, 1-NN | 96.5 % (duplicates in train) | 64.8 % (removed) | memorising model: +32 points |
306
+ | same images, small CNN | 97.3 % | 96.6 % | regularised model: < 1 point |
307
+ | TREC-6 text | 11 of 500 test questions also in train (2.2 %) | | AG News, SST: ≤ 0.14 % |
308
+
309
+ dataset-fingerprint's default split keeps subjects and source clips together, and flags them when a given split doesn't.
310
+ Details: [benchmarks/RESULTS.md](benchmarks/RESULTS.md#does-the-leakage-matter-four-domains).
311
+
312
+ ## Quality
313
+
314
+ Unit, integration (S3, Azure, GCS emulators) and security test suites run in CI on Linux and macOS for Python 3.9–3.13, alongside bandit, CodeQL, pip-audit, gitleaks and OpenSSF Scorecard. Releases are built once, carry provenance attestations, and go out through PyPI Trusted Publishing. See [SECURITY.md](SECURITY.md) for the threat model.
315
+
316
+ ## Citing
317
+
318
+ If dataset-fingerprint helps your work, please cite it. GitHub's **"Cite this repository"** button uses [`CITATION.cff`](CITATION.cff),
319
+ and every tagged release is archived with a DOI on Zenodo.
320
+
321
+ ```bibtex
322
+ @software{alamuri_dataset-fingerprint,
323
+ author = {Alamuri, Raj},
324
+ title = {dataset-fingerprint: a lockfile for training data},
325
+ url = {https://github.com/rajanalamuri/dataset-fingerprint},
326
+ version = {0.1.0},
327
+ year = {2026}
328
+ }
329
+ ```
330
+
331
+ Apache License 2.0 © Raj Alamuri · Alpha