unmake
unmake is a Python library for recording destructive operations in sessions and orchestrating undos later.
It is intentionally split into:
- Storage backend (you choose persistence strategy, e.g., SQLite)
- Operation payload (you define schema and reconstruction)
- Undo orchestration (library provides session + operation ordering)
Install
uv sync
Quickstart
from pathlib import Path
from unmake import HistoryManager, OperationRegistry, SQLiteStorage
manager = HistoryManager(SQLiteStorage("history.db"))
# Record a run
with manager.start_session(script="dangerous_script.py", args=["--force"]) as session:
Path("a.txt").rename("b.txt")
session.record_operation("fs.move", {"src": "a.txt", "dst": "b.txt"})
# Register reconstruction logic for undo
class MoveUndo:
def __init__(self, payload: dict):
self.src = payload["src"]
self.dst = payload["dst"]
def undo(self) -> None:
Path(self.dst).rename(self.src)
registry = OperationRegistry()
registry.register("fs.move", MoveUndo)
# Undo all operations in reverse order
session_id = manager.list_sessions(limit=1)[0].session_id
manager.undo_session(session_id, registry)
Development workflow
This project is configured for uv, make, and PEP 621 metadata.
make install
make test
make lint
make build
Publish
# Configure token in env first
# export UV_PUBLISH_TOKEN=...
make publish
Bump version
make bump-patch
make bump-minor
make bump-major
Thread Safety
InMemoryStorage
- Not thread-safe by default
- Use external locking for concurrent access:
import threading
from unmake import HistoryManager, InMemoryStorage
storage = InMemoryStorage()
manager = HistoryManager(storage)
lock = threading.Lock()
with lock:
with manager.start_session(script="safe.py") as session:
session.record_operation("demo.noop", {"value": 1})
SQLiteStorage
- Thread-safe for standard usage with one connection per method call
- SQLite handles concurrent access with internal locking
- Performance may degrade under very high contention
- Prefer one
HistoryManagerper thread
Best Practices
- Use
SQLiteStoragefor multi-threaded applications - Use
InMemoryStorageonly with external locking when shared across threads - Avoid sharing a mutable
HistoryManager+InMemoryStoragepair across threads
CLI
Install project dependencies and run:
unmake --db history.db list-sessions
unmake --db history.db show-session <session-id>
unmake --db history.db undo <session-id>
Metadata
Release files for unmake 0.1.4
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 |
|---|---|---|---|---|
| unmake-0.1.4.tar.gz | 14.5 kB | Without provenance | Details for unmake-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unmake-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for unmake-0.1.4-py3-none-any.whl |
Total release size: 31.3 kB
Release files / unmake-0.1.4.tar.gz
| Download URL | unmake-0.1.4.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a548846d56a7403976db0b2f8d53918efcb4149d15cce947e4f158d411a0793
|
|
BLAKE2b-256 checksum How to use checksums |
8dcbc2a412e17e9289f4b057a7a95edb2675e52ee5deb26845cfe2329cb2eba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / unmake-0.1.4-py3-none-any.whl
| Download URL | unmake-0.1.4-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c7feed7473294b44ccce5ccaa5bcc6277f5eed9a20cbfd03fb0c6e29b3b556b
|
|
BLAKE2b-256 checksum How to use checksums |
091e56639112f839a8a4d41babdd36ab92fcd87256c3f44ecc0a2aef4f316dff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for unmake 0.1.4
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.