Incremental smart backup CLI with content-addressed object storage
Project description
๐๏ธ snap-vault
Incremental smart backup CLI with content-addressed object storage
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.
If you found this useful, please โญ star the repo โ it helps a lot!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03b5a8614dea10409d8db5982eeaee23ac1d886f94be006d37a3f7a5a398f23f
|
|
| MD5 |
1db0b0200dee0fc02de109bbc301efbd
|
|
| BLAKE2b-256 |
a33307894e6e32c99117366a5b402c3f63b59095135d876d3829cf4c086731fe
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d18499ad8a01f713f201a2d25903bc9b01c17a1bd211d5c54f4fe9c7358f73
|
|
| MD5 |
62066b85741930293b4072906223348c
|
|
| BLAKE2b-256 |
098350a4956e5a67f112b7dd6164f1e4b51971f30685447b6e5560139865896b
|