Skip to main content

Lightweight versioning for data files with automatic change detection

Project description

Dataspool

Python 3.10+ License: MIT

Lightweight versioning for data files with automatic change detection.

Dataspool is a production-ready library for tracking changes in pandas DataFrames with minimal configuration. It automatically detects changes via content hashing and maintains a clean version history.

Features

  • Smart change detection - only saves when content actually changes
  • Automatic versioning with timestamps and comprehensive metadata
  • SHA256 content hashing for reliable change detection
  • Complete version history and audit trail
  • Zero configuration with sensible defaults
  • Comprehensive test coverage

Installation

pip install dataspool

Quick Start

import pandas as pd
from dataspool import save_with_version_control

df = pd.DataFrame({
    "Product": ["Apple", "Banana", "Cherry"],
    "Price": [1.50, 0.75, 2.25]
})

result = save_with_version_control(df, "prices")

if result["saved"]:
    print(f"New version saved: {result['version']}")
else:
    print("No changes detected")

Usage

Basic Versioning

from pathlib import Path
from dataspool import save_with_version_control

result = save_with_version_control(
    df,
    base_filename="my_data",
    data_dir=Path("./data"),
    save_latest=True
)

Version History

from dataspool import get_version_history, get_latest_version

history = get_version_history(Path("./data"))
for version in history:
    print(f"{version['timestamp']}: {version['row_count']} rows")

latest = get_latest_version(Path("./data"))
print(f"Latest: {latest['timestamp']}")

Change Detection

df1 = pd.DataFrame({"A": [1, 2, 3]})
result1 = save_with_version_control(df1, "test")  # saved=True

# Same content, different order - detected as identical
df2 = pd.DataFrame({"A": [3, 1, 2]})
result2 = save_with_version_control(df2, "test")  # saved=False

# Modified content - creates new version
df3 = pd.DataFrame({"A": [1, 2, 4]})
result3 = save_with_version_control(df3, "test")  # saved=True

Development

Setup with uv

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and install
git clone https://github.com/jmiloser/dataspool.git
cd dataspool
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Running Tests

pytest
pytest --cov=dataspool --cov-report=html

Code Quality

ruff format .
ruff check .
mypy src/

Roadmap

  • Support for Polars DataFrames
  • Parquet format support
  • Diff functionality between versions
  • Version rollback and restore
  • Cloud storage backends (S3, GCS, Azure)
  • CLI tool for version inspection
  • Automatic version pruning

License

MIT License - see LICENSE file for details.

Author

Jim Miloser - GitHub

Project details


Download files

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

Source Distribution

dataspool-0.1.0.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

dataspool-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file dataspool-0.1.0.tar.gz.

File metadata

  • Download URL: dataspool-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for dataspool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9c279e1b191e4131dc02bb8929d8d46d276e9bc71cae554b6d2ead9e4803ef3a
MD5 24d6ab00ae05e09eed68931d9277d94c
BLAKE2b-256 5d039dadaacbcdc474a1e8610b2663ceb3823befa3d79fbdda3bd8c174ea563c

See more details on using hashes here.

File details

Details for the file dataspool-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dataspool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for dataspool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4caf7cab39940e6b87cc8ad1085928c4e7b5d1dbf015dab4ec0f670e58c39548
MD5 df3b028ee7924728270e29307a53fef6
BLAKE2b-256 e08bdd29381b8360c8d4dcfcb9a1122ed4b56f4bd85f5016d1fe73496f3c70c5

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