Skip to main content

dazzle-preservelib

PyPI Release Date Python 3.9+ License: MIT Platform

Manifest + operations library -- the L3 orchestration layer of the DazzleLib stack.

It owns the preserve domain: the PreserveManifest (a content-hash record of what was copied, with DAG lineage), transactional copy / move / restore / verify operations, destination-conflict resolution, link-handling policy, and link-mirror reconciliation (linkmirror). It delegates the actual filesystem mechanics down the stack.

What this owns (and what it delegates)

Concern Layer
Manifest, operations, conflict resolution, link policy, verification dazzle-preservelib (L3, this lib)
File/link mechanics (create/detect/read/remove, copy, hash, metadata, disk-space) dazzle-filekit (L1)
UNC <-> drive identity unctools (L0)
Shared Protocols / TypedDicts / exception root dazzle-lib (B)
.dazzlelink record bridge (optional [dazzlelink] extra) dazzle-linklib (L2)

The orchestration and policy live here; the primitives they stand on belong to the layers below. This library is the destination of the P3 extraction that collapses three drifting preservelib copies (preserve, ghtraf, safedel) into one canonical home.

linkmirror -- reconcile links onto a mirrored tree

File-level mirrors (robocopy, Beyond Compare, preserve COPY) carry the files but frequently drop the links: symlinks and junctions vanish, hardlink groups arrive as independent duplicates. dazzle_preservelib.linkmirror is the mirror-scoped implementation of LinkHandlingMode.RECREATE (preserve#48 Phase 2, narrowed to the case that needs no lineage tracking: the destination already holds the copied files, so link identity is same relative path).

from dazzle_preservelib.linkmirror import (
    walk_scan, build_plan, apply_plan, verify_mirror,
)

manifest = walk_scan(r"D:\data")                # or mft.mft_scan (elevated, fast)
plan = build_plan(manifest, r"B:\data")         # diff against the mirror
result = apply_plan(plan, dry_run=False)        # additive-only: creates links,
                                                # restores link + parent times
report = verify_mirror(manifest, r"B:\data")    # byte/tick parity proof

Fidelity contract: targets are recreated verbatim (relative targets unresolved, intentionally-broken targets unrepaired, \\?\ forms kept) with the link's own timestamps at 100ns precision; existing destination entries are never modified (mismatches are reported as conflicts); re-runs are idempotent. Target rewriting (e.g. D:\ -> B:\ for drive retirement) is an explicit pluggable policy (make_prefix_rewrite_policy). Hardlink reconciliation is opt-in and sha256-guarded. The dz link-mirror tool (dazzlecmd) is the thin CLI over this engine.

Scanner backends: a portable os.scandir walk, and a Windows MFT/USN enumeration (linkmirror.mft, requires elevation) that inventories multi-million-record volumes in minutes -- field-proven mirroring 2,644 links off a failing 51M-record drive with nanosecond-identical timestamps and zero additional wear.

The stack

Layer Library Role
B dazzle-lib bedrock contracts
L0 unctools path identity
L1 dazzle-filekit filesystem primitives
L2 dazzle-linklib link record + resolver
L3 dazzle-preservelib (this) manifest + operations
⊥ dazzle-treelib traversal engine

Status

Functional (0.8.0 shipped the P3 extraction; 0.9.0 added linkmirror). The manifest + operations API is locked (see docs/api-stability.md); the preserve CLI consumes this library. The linkmirror package is provisional in 0.9.x (API may still refine; locks at 0.10). See the Roadmap.

Installation

pip install dazzle-preservelib

From source

git clone https://github.com/DazzleLib/dazzle-preservelib.git
cd dazzle-preservelib
pip install -e ".[dev]"

Development

python -m venv .venv
source .venv/bin/activate   # or .venv\Scripts\activate on Windows
pip install -e ".[dev]"

# Run tests
python -m pytest tests/ -v

# Install git hooks
bash scripts/install-hooks.sh

License

MIT. See LICENSE for details. The whole DazzleLib stack is MIT (STACK-MAP D11).

Metadata

Release files for dazzle-preservelib 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dazzle-preservelib 0.9.0
File Size Uploaded Provenance Actions
dazzle_preservelib-0.9.0.tar.gz 120.9 kB With provenance Details for dazzle_preservelib-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dazzle-preservelib 0.9.0
File Interpreter ABI Platform Actions
dazzle_preservelib-0.9.0-py3-none-any.whl Python 3 none any Details for dazzle_preservelib-0.9.0-py3-none-any.whl

Total release size: 221.1 kB

Release files / dazzle_preservelib-0.9.0.tar.gz

Download URL dazzle_preservelib-0.9.0.tar.gz
Size 120.9 kB
Tags Source
SHA-256 checksum
How to use checksums
05b6258ceca448f52f465738eb2caa47b25e9d78d155bb8e9fd8544fce3e2df0
BLAKE2b-256 checksum
How to use checksums
e9446dcdfc4871d6a61b251203266d33fb940a8e7ff3173ec7ddc1ef33a0a9cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / dazzle_preservelib-0.9.0-py3-none-any.whl

Download URL dazzle_preservelib-0.9.0-py3-none-any.whl
Size 100.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f4345ffd2ad2423bcfd6bae55ec9cb31f24962debf2809d845df9ee9f0d8118
BLAKE2b-256 checksum
How to use checksums
e8d2717fc68994d9f17793071d16f2e7d1023dc010aab71ddacd750a0368ca51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Security for dazzle-preservelib 0.9.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dazzle_preservelib-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page