Skip to main content

Incremental smart backup CLI with content-addressed object storage

Project description

๐Ÿ—„๏ธ snap-vault

Incremental smart backup CLI with content-addressed object storage

PyPI version Python License: MIT PyPI Downloads

Zero dependencies ยท Pure Python stdlib ยท Blazing fast ยท Cross-platform

Installation ยท Usage ยท How It Works ยท Demo ยท Why snap-vault


๐Ÿš€ What is snap-vault?

snap-vault is a command-line tool that takes incremental snapshots of any directory.

Instead of copying everything every time, it only stores what actually changed โ€” using SHA-256 content hashing and a content-addressed object store (same strategy Git uses internally). Every snapshot is a full manifest, every object is stored exactly once, and you can restore any snapshot at any point in time.

Built entirely with Python's standard library. No external dependencies. No APIs. No cloud. Just fast, concurrent, local backup.


โœจ Features

Feature Description
๐Ÿ“ธ Incremental snapshots Only changed files are stored โ€” unchanged files are deduplicated automatically
๐Ÿ” Content-addressed storage Files stored by SHA-256 hash, never duplicated on disk
โšก Concurrent file I/O ThreadPoolExecutor for fast parallel hashing and copying
๐Ÿ” Diff engine See exactly what changed (added / modified / deleted) since the last snapshot
โช Point-in-time restore Restore any snapshot by ID or default to the latest
๐Ÿ“Š Snapshot history Full timeline of snapshots with timestamps, file counts, and change stats
๐ŸŽจ Beautiful terminal output Colored progress bars, tables, and status icons
๐Ÿ“ฆ Zero dependencies Pure Python stdlib โ€” works anywhere Python 3.9+ runs

๐Ÿ“ฆ Installation

pip install snap-vault-cli

Or install from source:

git clone https://github.com/abdulrehman10raja/snap-vault-cli
cd snap-vault-cli
pip install -e .

Verify the install:

snap-vault --version
# snap-vault 0.1.0

๐ŸŽฌ Demo

$ snap-vault snap ./my-project ./my-vault

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚             SNAP-VAULT  ยท  Taking Snapshot             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

  โ†’ Source : /home/user/my-project
  โ†’ Vault  : ./my-vault
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โ†’ Scanning source directory...
  โ†’ Found 42 file(s) โ€” hashing concurrently...
  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 100%
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โ†’ Snapshot ID : 20260626_103000_123
  โ†’ Storing 5 new/modified object(s)...
  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ 100%
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  Added                          3
  Modified                       2
  Deleted                        0
  Unchanged                      37
  Objects stored                 5
  Deduplicated                   0
  Total size                     1.2 MB
  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  โœ“ Snapshot 20260626_103000_123 saved successfully.

๐Ÿ› ๏ธ Usage

snap โ€” Take an incremental snapshot

snap-vault snap <source> <vault>
snap-vault snap ./my-project ./my-vault

Scans the source directory, hashes all files concurrently, compares with the last snapshot, and stores only what changed. If nothing changed, it tells you instantly.


diff โ€” See what changed since last snapshot

snap-vault diff <source> <vault>
snap-vault diff ./my-project ./my-vault

Shows every file that was added, modified, or deleted since the last snapshot โ€” without taking a new one. Perfect for reviewing before committing a snapshot.


history โ€” View all snapshots

snap-vault history <vault>
snap-vault history ./my-vault

Lists every snapshot in the vault with its timestamp, file count, and change statistics.

  20260626_014030_196
    Date                         2026-06-26  01:40:30
    Files                        42
    Added                        0
    Modified                     1
    Deleted                      0
    Total size                   1.2 MB

restore โ€” Restore files from a snapshot

snap-vault restore <vault> <target> [--snap SNAPSHOT_ID]
# Restore latest snapshot
snap-vault restore ./my-vault ./restored-output

# Restore a specific snapshot by ID (point-in-time restore)
snap-vault restore ./my-vault ./restored-output --snap 20260626_103000_123

Restores all files from the chosen snapshot into the target directory. Creates the target if it doesn't exist.


โš™๏ธ How It Works

snap-vault snap ./project ./vault
        โ”‚
        โ–ผ
  Scan source directory
        โ”‚
        โ–ผ
  Hash all files concurrently (SHA-256, ThreadPoolExecutor)
        โ”‚
        โ–ผ
  Load previous manifest (if any)
        โ”‚
        โ–ผ
  Compute diff (added / modified / deleted / unchanged)
        โ”‚
        โ–ผ
  Store new/changed files as content-addressed objects
  (.snapvault/objects/ab/cdef1234...)
        โ”‚
        โ–ผ
  Save new manifest with full file tree + stats
  (.snapvault/manifests/20260626_103000_123.json)

Vault Structure

my-vault/
โ””โ”€โ”€ .snapvault/
    โ”œโ”€โ”€ config.json                     โ† vault metadata
    โ”œโ”€โ”€ manifests/
    โ”‚   โ”œโ”€โ”€ 20260626_103000_123.json    โ† snapshot 1
    โ”‚   โ””โ”€โ”€ 20260626_120000_456.json    โ† snapshot 2
    โ””โ”€โ”€ objects/
        โ”œโ”€โ”€ ab/
        โ”‚   โ””โ”€โ”€ cdef1234...             โ† stored file content (by hash)
        โ””โ”€โ”€ 7f/
            โ””โ”€โ”€ 9a2b3c...

Objects are stored by the first 2 characters of their SHA-256 hash as a subdirectory โ€” the same content-addressing strategy used by Git.


๐Ÿ“Š Why snap-vault?

Feature snap-vault cp -r rsync
Incremental (only changed files) โœ… โŒ โœ…
Content deduplication โœ… โŒ โŒ
Snapshot history โœ… โŒ โŒ
Point-in-time restore โœ… โŒ โŒ
Zero dependencies โœ… โœ… โŒ
Cross-platform โœ… โš ๏ธ โš ๏ธ
Colored CLI output โœ… โŒ โŒ
Works offline โœ… โœ… โœ…

๐Ÿงฑ Project Structure

snap-vault-cli/
โ”œโ”€โ”€ snap_vault/
โ”‚   โ”œโ”€โ”€ __init__.py     โ† version info
โ”‚   โ”œโ”€โ”€ __main__.py     โ† entry point
โ”‚   โ”œโ”€โ”€ cli.py          โ† argument parsing
โ”‚   โ”œโ”€โ”€ core.py         โ† snap / diff / restore / history logic
โ”‚   โ”œโ”€โ”€ display.py      โ† terminal colors, progress bars, tables
โ”‚   โ””โ”€โ”€ manifest.py     โ† vault structure, object store, manifests
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

๐Ÿ“‹ Requirements

  • Python 3.9+
  • No external packages โ€” stdlib only

๐Ÿ“„ License

MIT ยฉ Abdul Rehman


๐Ÿ‘จ๐Ÿ’ป Author

Built by Abdul Rehman โ€” BSCS student at FAST-NUCES Islamabad, AI Engineering Intern at Prime Innovators Global.

GitHub LinkedIn PyPI


If you found this useful, please โญ star the repo โ€” it helps a lot!

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

snap_vault_cli-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

snap_vault_cli-0.1.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: snap_vault_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for snap_vault_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03b5a8614dea10409d8db5982eeaee23ac1d886f94be006d37a3f7a5a398f23f
MD5 1db0b0200dee0fc02de109bbc301efbd
BLAKE2b-256 a33307894e6e32c99117366a5b402c3f63b59095135d876d3829cf4c086731fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snap_vault_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for snap_vault_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12d18499ad8a01f713f201a2d25903bc9b01c17a1bd211d5c54f4fe9c7358f73
MD5 62066b85741930293b4072906223348c
BLAKE2b-256 098350a4956e5a67f112b7dd6164f1e4b51971f30685447b6e5560139865896b

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