Skip to main content

dazzle-linklib

PyPI Release Date Python 3.9+ License: MIT Platform

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 .dazzlelink file 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 dazzlelink CLI or preserve). The tests/test_no_upstream_imports.py canary 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?

"Buy Me A Coffee"

License

This project is licensed under the MIT License -- see the LICENSE file for details. The whole DazzleLib stack is MIT (STACK-MAP D11).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dazzle_linklib-0.3.0.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dazzle_linklib-0.3.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file dazzle_linklib-0.3.0.tar.gz.

File metadata

  • Download URL: dazzle_linklib-0.3.0.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dazzle_linklib-0.3.0.tar.gz
Algorithm Hash digest
SHA256 bd38caf3eabf6ce79989e16ff2d15483c6b9cc72b002e6716efc067238c1d0f3
MD5 d81231b987a07cbc7f68f233aaade674
BLAKE2b-256 52cffae686e45b6969fec521400ecd2d0b4c1a6239de9c98776c11606d16d836

See more details on using hashes here.

Provenance

The following attestation bundles were made for dazzle_linklib-0.3.0.tar.gz:

Publisher: release.yml on DazzleLib/dazzle-linklib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dazzle_linklib-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dazzle_linklib-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for dazzle_linklib-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77800a6e596414cc123bf40bff2765f6328d7855cf4eee1532a03225c170e893
MD5 3f0576fdfed1850d3bde32ec1bc86bd8
BLAKE2b-256 f6505786fb0bb812628067f21e542297e9764fcee0b9c2c7783747c7c42ea788

See more details on using hashes here.

Provenance

The following attestation bundles were made for dazzle_linklib-0.3.0-py3-none-any.whl:

Publisher: release.yml on DazzleLib/dazzle-linklib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.2

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page