Metadata-Version: 2.5
Name: snapshotpy
Version: 0.1.0
Summary: A universal object diff, patch, snapshot, and state-change engine for Python.
Project-URL: Homepage, https://github.com/yashraj-ghemud/snapshotpy
Project-URL: Repository, https://github.com/yashraj-ghemud/snapshotpy
Project-URL: Issues, https://github.com/yashraj-ghemud/snapshotpy/issues
Project-URL: Author, https://github.com/yashraj-ghemud
Author: Yashraj Sachin Ghemud
Maintainer: Yashraj Sachin Ghemud
License: MIT
License-File: AUTHORS.md
License-File: LICENSE
Keywords: diff,json,patch,snapshot,state-management,testing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pydantic>=2.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install snapshotpy
```

## Quick start

```python
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

```bash
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](https://github.com/yashraj-ghemud)
- Repository: [github.com/yashraj-ghemud/snapshotpy](https://github.com/yashraj-ghemud/snapshotpy)
- PyPI: [pypi.org/project/snapshotpy](https://pypi.org/project/snapshotpy/)

## License

SnapshotPy is distributed under the MIT License. See [LICENSE](LICENSE).

## Contributing

Issues, suggestions, and pull requests are welcome through the [GitHub repository](https://github.com/yashraj-ghemud/snapshotpy).

Copyright © 2026 Yashraj Sachin Ghemud.
