SnapshotPy
SnapshotPy is a typed Python library for comparing values, explaining structured changes, applying patches, reversing changes, serializing patch data, and creating deterministic snapshots for tests and debugging.
The project is authored and maintained by Yashraj Sachin Ghemud.
Installation
pip install snapshotpy
Quick start
from snapshotpy import apply_patch, diff, reverse_patch
before = {"name": "Alice", "age": 30}
after = {"name": "Alice", "age": 31, "city": "New York"}
patch = diff(before, after)
updated = apply_patch(patch, before)
restored = apply_patch(reverse_patch(patch), updated)
assert updated == after
assert restored == before
A Patch contains structured Operation objects. Each operation records its operation type, canonical path, and relevant values. Patch objects can also be serialized to JSON for storage or transport.
Public API
| API | Purpose |
|---|---|
diff(before, after) |
Build a structured patch. |
apply_patch(patch, value) |
Apply a patch without mutating the caller-owned input. |
reverse_patch(patch) |
Build a reverse patch when prior values are available. |
serialize_patch(patch) |
Serialize a patch to JSON. |
deserialize_patch(data) |
Restore a patch from JSON. |
snapshot(value) |
Produce deterministic, readable JSON output. |
compare(left, right) |
Compare two values for equality. |
Development
pip install -e ".[dev]"
pytest
ruff check .
mypy src/snapshotpy
python -m build
Project status
SnapshotPy is currently released as version 0.1.0 and is intended for JSON-like structures and foundational diff/patch workflows. The project deliberately does not perform database transactions, network operations, filesystem synchronization, or semantic domain conflict resolution.
Author and maintainer
Yashraj Sachin Ghemud
- GitHub: @yashraj-ghemud
- Repository: github.com/yashraj-ghemud/snapshotpy
- PyPI: pypi.org/project/snapshotpy
License
SnapshotPy is distributed under the MIT License. See LICENSE.
Contributing
Issues, suggestions, and pull requests are welcome through the GitHub repository.
Copyright © 2026 Yashraj Sachin Ghemud.
Metadata
Release files for snapshotpy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| snapshotpy-0.1.0.tar.gz | 6.2 kB | Without provenance | Details for snapshotpy-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| snapshotpy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for snapshotpy-0.1.0-py3-none-any.whl |
Total release size: 13.1 kB
Release files / snapshotpy-0.1.0.tar.gz
| Download URL | snapshotpy-0.1.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f1c570a21cee0b1817f3d8f8ced7333b1d470bc70212a79d886890de05fd1ff
|
|
BLAKE2b-256 checksum How to use checksums |
5350fb587fa7db5bd3074f804f56599502635124aac4f7723993d1475664563e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / snapshotpy-0.1.0-py3-none-any.whl
| Download URL | snapshotpy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04b3f4e35c17763f5a19b177846243cbe5764ce77f77c9c69a423e1fc6dcc738
|
|
BLAKE2b-256 checksum How to use checksums |
809661b763f7b424211478d1029a1b86de7258eb9c61c3d9437c262980729653
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for snapshotpy 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.