Filesystem state snapshots with diff comparison
Project description
philiprehberger-dir-snapshot
Filesystem state snapshots with diff comparison.
Installation
pip install philiprehberger-dir-snapshot
Usage
Take a Snapshot
from philiprehberger_dir_snapshot import snapshot
snap = snapshot("./src")
print(f"Found {len(snap.files)} files")
Compare Snapshots
before = snapshot("./src")
# ... make changes ...
after = snapshot("./src")
diff = before.diff(after)
print(diff.summary())
for f in diff.added:
print(f"+ {f.path}")
for f in diff.removed:
print(f"- {f.path}")
for f in diff.modified:
print(f"~ {f.path}")
Save and Load
# Save to JSON
before.to_json("snapshot.json")
# Load later
from philiprehberger_dir_snapshot import Snapshot
restored = Snapshot.from_json("snapshot.json")
Options
# Include only Python files
snap = snapshot("./src", include=["*.py"])
# Exclude build artifacts
snap = snapshot(".", exclude=["__pycache__", "*.pyc", ".git"])
# Use faster hashing (or disable with "none")
snap = snapshot(".", hash_mode="md5")
API
snapshot(path, hash_mode="sha256", include=None, exclude=None)— Create a snapshotSnapshot.diff(other)— Compare two snapshots, returnsSnapshotDiffSnapshot.to_json(path)/Snapshot.from_json(path)— Serialize/deserializeSnapshotDiff.summary()— Human-readable diff summary
License
MIT
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 philiprehberger_dir_snapshot-0.1.5.tar.gz.
File metadata
- Download URL: philiprehberger_dir_snapshot-0.1.5.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6f80d88159769561d5822f09385de68caac04fda42d43b1e83d6dd2c6c82cf3
|
|
| MD5 |
3d8f477fe44b1b291df631ca2cccf4cf
|
|
| BLAKE2b-256 |
14b14ed46e8a22c142b17b9c00861f994ff7a8befb94db77ff6f0a63335e0240
|
File details
Details for the file philiprehberger_dir_snapshot-0.1.5-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_dir_snapshot-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ec41471f66b3200ec77db1082a745f032e7ee7e1d0e8f0a4f2a064facea1b9
|
|
| MD5 |
54e34e9a7bef4a5de7e7a62e148c9155
|
|
| BLAKE2b-256 |
9ce112c55c73988ab9abf1aad81f97da91a140734d05fd6c6e87f252c1529eb1
|