Skip to main content

A minimal dataset versioning system for text data with a focus on reproducibility.

Project description

Marco Dataset Versioning System (DVCS)

A minimal dataset versioning system for text data with a strong focus on reproducibility and transparency. Treat your text datasets like code โ€” immutable, versioned, reproducible, and explainable.

Marco acts as a lightweight Python CLI tool that you initialize inside any ML project folder to safely version and preprocess your datasets without altering your original files.


๐Ÿš€ Installation

# Recommended: install inside a virtual environment
python -m venv venv
source venv/bin/activate        # Linux / macOS
venv\Scripts\activate           # Windows

pip install marco-dvcs

๐Ÿ—‚๏ธ Quick Command Reference

Command Description
marco init Initialize a Marco repository in the current directory
marco upload <file> Create a versioned, preprocessed dataset snapshot
marco list List all tracked versions
marco lineage Print ASCII lineage tree
marco diff <v1> <v2> Compare two versions (unified diff or metrics)
marco restore <version> Restore processed data to your workspace
marco attach-results <version> <file> Attach a training results file to an existing version
marco export <version> <dest> Export a version to .tar.gz
marco import <tarball> Import a version from a .tar.gz
marco delete <version> Delete a version and heal the lineage
marco token-analytics <v1> <v2> KL-divergence token shift analysis
marco evaluate <version> Dataset structural health report
marco drift <v1> <v2> Detect model performance degradation
marco verify <version> Cryptographic reproducibility proof
marco verify-all Audit every version in the repo
marco generate-web Launch the interactive web UI

๐Ÿ› ๏ธ Usage Guide

1. Initialize a Repository

Initialize Marco tracking in your current project directory. Creates a .marco/ folder with registry, chain, and lock files.

marco init

2. Create an Immutable Version (upload)

Upload a raw .txt, .csv, or .tsv dataset. Marco runs the preprocessing pipeline, computes a SHA-256 hash, and creates an immutable snapshot.

Interactive Mode โ€” no config file needed; Marco prompts you step by step:

marco upload my_dataset.csv -t v1-raw

Config Mode โ€” supply a config.json to skip the prompts:

marco upload my_dataset.csv -c config.json -t v1-processed

With Training Results โ€” bundle a results file at upload time:

marco upload my_dataset.csv -t v1-trained -r ./results/training_results.txt

Note: During upload, Marco auto-generates raw_stats.json (pre-pipeline statistics) and post_stats.json (post-pipeline reduction statistics) inside the version directory.

The config file format for a preprocessing pipeline (config.json):

{
  "dag": {
    "step_1_normalize_newlines": { "func": "normalize_newlines", "params": {}, "depends_on": [] },
    "step_2_lowercase":          { "func": "lowercase",          "params": { "enabled": true }, "depends_on": ["step_1_normalize_newlines"] },
    "step_3_remove_stopwords":   { "func": "remove_stopwords",   "params": { "language": "english" }, "depends_on": ["step_2_lowercase"] },
    "step_4_filter_length":      { "func": "filter_length",      "params": { "min_tokens": 5, "max_tokens": 200 }, "depends_on": ["step_3_remove_stopwords"] },
    "step_5_deduplicate":        { "func": "deduplicate",        "params": { "method": "exact" }, "depends_on": ["step_4_filter_length"] }
  }
}

Available pipeline functions:

Function Params Description
normalize_newlines โ€” Collapse \r\n and \r to \n
lowercase enabled: bool Convert all text to lowercase
tokenize method: "whitespace"|"word"|"char" Tokenize text (adds n_tokens column)
remove_stopwords language: "english"|... Remove common stopwords
filter_length min_tokens: int, max_tokens: int Drop docs outside token range
deduplicate method: "exact" Remove duplicate rows

3. Attach Training Results (Decoupled Workflow)

If you train after uploading, attach results to the existing version later:

# Step 1 โ€” restore preprocessed data for training
marco restore v1-raw -o ./my_training_data.tsv

# Step 2 โ€” train your model, then attach the results
marco attach-results v1-raw training_results.txt
# alias:
marco attach v1-raw training_results.txt

4. List Versions

marco list

Prints a table of all versions with short hash, timestamp, user, and tags.


5. View Lineage Tree

ASCII-art visualisation of the full project history up to the Root Node:

marco lineage

6. Restore / Checkout Data

Extract the processed dataset back into your workspace for training:

marco restore v1-processed -o ./training_data.tsv
# alias:
marco checkout v1-processed -o ./training_data.tsv

7. Export / Import Versions

Share dataset versions with teammates as portable .tar.gz archives:

# Export
marco export v1-raw ./exports/

# Import
marco import ./exports/marco_version_e5e0b767.tar.gz

8. Delete a Version

Deletes the version files and heals the lineage so descendant version links remain valid:

marco delete v1-raw
# alias:
marco rm e5e0b767

9. Diff Versions

Compare two versions with a human-readable metric summary and unified line-by-line diff:

# Diff raw input (default)
marco diff v1.0 v2.0

# Diff preprocessed output
marco diff v1.0 v2.0 --target preprocessed

# Diff DAG config
marco diff v1.0 v2.0 --target config

# Control context lines (default 3)
marco diff v1.0 v2.0 --context 10

# Save a Markdown metrics report instead of printing to terminal
marco diff v1.0 v2.0 --save ./reports

Example output:

๐Ÿ“Š Summary: v1.0 โ†’ v2.0
  โ–บ N Documents: 2.00% increase (50 โ†’ 51)
  โ–บ N Tokens: 15.30% increase (1000 โ†’ 1153)
  โ–บ Vocab Size: 5.10% increase (300 โ†’ 315)
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

--- v1.0 (abc12345)/raw.txt
+++ v2.0 (def67890)/raw.txt
@@ -1,5 +1,6 @@
  positive  Great product, love it!
-negative  Terrible experience.
+negative  Poor experience, not recommended.
+negative  Worst purchase I ever made.

10. Token Analytics (KL Divergence)

Measure how token probability distributions shift between two versions using Kullback-Leibler divergence:

marco token-analytics v1-raw v2-processed

Returns a JSON report with vocabulary overlap, token frequency shifts, and top divergent terms.


11. Evaluate Dataset Health

Get a comprehensive structural health report for a single version โ€” pipeline determinism grade, data volatility index, and reproducibility confidence score:

marco evaluate v1-processed

Example output:

๐Ÿ“Š Evaluating Structural Health of Dataset 'v1-processed'...

  โ–บ Pipeline Determinism... [A Grade]
  โ–บ Computing Data Volatility (vs. Raw)... [12% Volatile]
  โ–บ Running Reproducibility Proofs... [High Confident]

โœ… Evaluation Complete! Overall Health: EXCELLENT
๐Ÿ“„ Generating full report: .marco/versions/<id>/evaluation_report.json

12. Model Drift Detection

Detect performance degradation when training data changes. Marco extracts metrics from your attached training_results.txt (regex-based) and runs an internal NaiveBayes model against the new data in-memory:

marco drift v1-trained v2-processed

Example output:

MODEL DRIFT ANALYSIS
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Trained on:   v1-trained (fe4403)
Evaluated on: v2-processed (a3f9c1)
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Metric       Baseline    New Data    Drop     Severity
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Accuracy     0.700       0.612      -12.6%   CRITICAL
F1           0.547       0.485      -11.3%   CRITICAL
โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Overall: RETRAIN

13. Reproducibility Verification

Verify a single version

Re-runs the pipeline from scratch and compares the hash against the stored manifest:

marco verify v1-raw
# also accepts full hash
marco verify fe44032c

Example output:

๐Ÿ”ฌ Verifying version: fe44032c70164a71...

  Pipeline Step Verification:
    โœ…  step_1 normalize_newlines
    โœ…  step_2 lowercase

  Stored  output_hash: ed610672ea28e065...
  Recomputed   hash:   ed610672ea28e065...

  โœ… VERIFIED โ€” output hash matches. Version is reproducible.

Verify all versions at once

marco verify-all

Returns exit code 1 if any version fails โ€” CI/CD compatible.


14. Web UI (generate-web)

Launch a local interactive web UI to visually explore all your tracked versions, their DAG pipelines, preprocessed data, training results, and health statistics.

marco generate-web

Opens http://localhost:7654 in your browser automatically. Features include:

View Description
DAG Interactive pipeline graph โ€” click any node to inspect step metrics and parameters
Code Pipeline steps rendered as readable code blocks
Data Browse raw input, preprocessed output, training results, and config per version
Sidebar Git-style lineage tree grouped by chain with ref labels (v1-raw, v2-updated, etc.)
Summary Bar Key metrics (docs, tokens, vocab) with +/- delta when comparing two versions

Press Ctrl+C to stop the server.


๐Ÿ”ฌ Reproducibility Engine โ€” 7-Layer Architecture

# Guarantee How
1 Step-by-step hash verification Hashes output after every DAG step; pinpoints the exact step that introduced non-determinism
2 Byte-exact canonical enforcer Serializes data to a fixed TSV format (Unix LF, fixed columns, UTF-8) before hashing
3 Row-level delta on FAIL Computes exactly which rows differ and saves them in verification_report.json
4 Permanent audit trail Every run appended to .marco/verification_log.jsonl (tamper-evident)
5 Environment fingerprinting Stores Python / NumPy / Pandas versions; warns on re-run if environment changed
6 Stochastic operation detector Warns if pipeline contains shuffle / random_sample without a seed
7 Manifest integrity update Sets "verified": true/false in manifest.json after every run

๐Ÿง  Architecture Overview

marco/
โ”œโ”€โ”€ cli/
โ”‚   โ”œโ”€โ”€ main.py          โ€” CLI entry point, all command routing
โ”‚   โ”œโ”€โ”€ interactive.py   โ€” Interactive pipeline builder (prompts)
โ”‚   โ””โ”€โ”€ web_serve.py     โ€” HTTP server for the React web UI
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ repository.py    โ€” Version CRUD, refs.json tagging, file immutability
โ”‚   โ”œโ”€โ”€ preprocessor.py  โ€” DAG-based preprocessing engine (topological sort)
โ”‚   โ”œโ”€โ”€ comparator.py    โ€” Unified diff and Markdown metric reports
โ”‚   โ””โ”€โ”€ evaluate.py      โ€” Structural health evaluation (DVI, RCS grades)
โ”œโ”€โ”€ token_analytics/
โ”‚   โ””โ”€โ”€ distribution.py  โ€” KL divergence & token frequency shift analysis
โ”œโ”€โ”€ model_drift/         โ€” In-memory NaiveBayes drift detection
โ”œโ”€โ”€ reproducibility_proof/
โ”‚   โ”œโ”€โ”€ verify.py        โ€” End-to-end reproducibility verification
โ”‚   โ”œโ”€โ”€ canonicalizer.py โ€” Byte-exact canonical serialization
โ”‚   โ””โ”€โ”€ audit_log.py     โ€” Append-only verification log
โ””โ”€โ”€ ui/                  โ€” React + Vite web UI source
    โ””โ”€โ”€ dist/            โ€” Built UI assets served by generate-web

Have fun building safer machine learning pipelines! ๐Ÿš€

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marco_dvcs-0.1.67.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marco_dvcs-0.1.67-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file marco_dvcs-0.1.67.tar.gz.

File metadata

  • Download URL: marco_dvcs-0.1.67.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for marco_dvcs-0.1.67.tar.gz
Algorithm Hash digest
SHA256 32b5c70e4b48668948f93bb675c688ad44291a843fa7956688e13ee2305d2532
MD5 9d309a8a7eabdf5049f3e168368dd7e6
BLAKE2b-256 d80dba31dbefdd951784d1e0b287dc39a7b0f0540bacb33fafa12bb6c2024883

See more details on using hashes here.

File details

Details for the file marco_dvcs-0.1.67-py3-none-any.whl.

File metadata

  • Download URL: marco_dvcs-0.1.67-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for marco_dvcs-0.1.67-py3-none-any.whl
Algorithm Hash digest
SHA256 db8397f040da2d5177a980d9ec4ad17457153c19a3fc86d25fd5336864ba8b45
MD5 a2a0dacc87370774202e0ef3bb35e925
BLAKE2b-256 e19f145af54897372b0450d1191542617ae1fd019246b78a1c959cfa95da22bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page