dazzle-linklib
Content-addressable link-record library -- the L2 serialization layer of the DazzleLib stack.
A link record maps an identity to a typed list of locators plus metadata, and knows how to serialize, find, and resolve itself. One model serves three consumers:
- the dazzlelink filesystem CLI (the
.dazzlelinkfile format), - preserve's content-hash manifest (L3), and
- Relinker -- a hash-addressed, decentralized anti-link-rot resolver
(
rln.kr/{hash}-> a multi-protocol location set).
What this owns (and what it doesn't)
dazzle-linklib owns the link record: its schema, JSON I/O, the locator
list, content_id, relation edges, and the injectable target resolver. It
delegates the rest down the stack:
| Concern | Layer |
|---|---|
Link record, locators, content_id, relations, resolve |
dazzle-linklib (L2, this lib) |
| File/link mechanics (create/detect/read, copy, hash, metadata) | dazzle-filekit (L1) |
| UNC <-> drive identity, path origin classification | unctools (L0) |
| Shared Protocols / TypedDicts / exception root | dazzle-lib (B) |
| Graph traversal (walking the records' relation edges) | dazzletreelib (perpendicular) |
"Records that point at each other" live here; "walking and interpreting those pointers" do not. (See the L2 design rationale, decision D6.)
The stack
| Layer | Library | Role |
|---|---|---|
| B | dazzle-lib | bedrock contracts (Protocols, TypedDicts, exception root) |
| L0 | dazzle-unctools | path identity (UNC/drive/origin) |
| L1 | dazzle-filekit | filesystem primitives |
| L2 | dazzle-linklib (this) | link record + resolver |
| L3 | dazzle-preservelib (planned) | operation orchestration |
| ⊥ | dazzle-treelib | traversal engine |
Full architecture contract: STACK-MAP.md. API stability policy: docs/api-stability.md.
Status
Pre-alpha (0.2.0) -- first functional release. The link-record core (stack
phase P2) is extracted from the dazzlelink tool: the record model
(DazzleLinkData), record discovery/rebase (find_dazzlelinks/scan/rebase),
and the injectable target resolver (resolve_target). It is verified
wire-compatible with the published dazzlelink 0.8.0 tool in both directions.
The down-stack delegation of filesystem mechanics to dazzle-filekit (L1) and
unctools (L0) follows -- see the
Roadmap.
Usage
from dazzle_linklib import DazzleLinkData, find_dazzlelinks, resolve_target
# Read a .dazzlelink record (nested JSON, legacy flat, or embedded-script form).
record = DazzleLinkData.from_file("photo.png.dazzlelink")
print(record.get_target_path())
# Author a record with typed locators + a content identity (Relinker-ready).
record = DazzleLinkData()
record.set_target_path(r"D:\archive\photo.png")
record.add_locator("ipfs", "QmHash...")
record.set_content_id("sha256", "deadbeef...")
record.save_to_file("photo.png.dazzlelink")
# Discover records under a tree and resolve one to its first live locator.
for path in find_dazzlelinks("backup/", recursive=True):
located = resolve_target(DazzleLinkData.from_file(str(path)))
print(path, "->", located)
Installation
pip install dazzle-linklib
From source
git clone https://github.com/DazzleLib/dazzle-linklib.git
cd dazzle-linklib
pip install -e ".[dev]"
Contributing
Contributions welcome! Please open an issue or submit a pull request.
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
Two house rules this library lives by:
- Dependencies point down only. L2 consumes the bedrock and the layers below
it; it never imports its consumers (the
dazzlelinkCLI or preserve). Thetests/test_no_upstream_imports.pycanary enforces this. - The public surface is locked. Record/discovery/resolver symbols are pinned
by
tests/test_import_stability.py; changes follow docs/api-stability.md (locked surface, noisy-shim deprecation, additive-only schema evolution).
Like the project?
License
This project is licensed under the MIT License -- see the LICENSE file for details. The whole DazzleLib stack is MIT (STACK-MAP D11).
Metadata
Release files for dazzle-linklib 0.5.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 | |
|---|---|---|---|
| dazzle_linklib-0.5.0.tar.gz | 43.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dazzle_linklib-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.0 kB
Release files / dazzle_linklib-0.5.0.tar.gz
| Download URL | dazzle_linklib-0.5.0.tar.gz |
|---|---|
| Size | 43.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58c3c95c9b48a9f6e2a08aa55820cf84e74b1bc516a250fa66513ac7dbd40576
|
|
BLAKE2b-256 checksum How to use checksums |
d104db7813067a2d6abb4da2c9c6f218827fcf9f8a4202bf07149d5d20fb0893
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 31, 2026.
Transparency logRelease files / dazzle_linklib-0.5.0-py3-none-any.whl
| Download URL | dazzle_linklib-0.5.0-py3-none-any.whl |
|---|---|
| Size | 29.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9084db76e5025492c51b72f0410f4e197014ca8d8eb989b41442a3afa8b3c2b
|
|
BLAKE2b-256 checksum How to use checksums |
5e9ff75c615a715c48c3b389c6c6bc89aabfa5ef5b79ac42fce48740806b1b00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.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 31, 2026.
Transparency log