The DazzleLib bedrock: shared Protocols, TypedDict payload schemas, and exception root for the dazzle-* library stack. Stdlib-only by charter.
Project description
dazzle-lib
The DazzleLib stack's bedrock: shared Protocols, TypedDict payload schemas, and the exception root.
Every dazzle-* library (the stack) builds on this package: it defines what stack objects can be expected to do (view themselves, serialize themselves) and what shapes cross-layer payloads have. Types only -- by charter this package contains no I/O, no path handling, no platform probing, and no behavior, forever.
pip install dazzle-lib
What's inside (all of it)
| Module | Contents |
|---|---|
dazzle_lib.protocols |
Viewable (summary()/__str__), Serializable (to_dict/from_dict/to_json, SCHEMA_VERSION) -- structural Protocols, runtime_checkable, nothing is forced to subclass |
dazzle_lib.payloads |
The cross-layer TypedDict schemas: FileMetadataDict, TimestampsDict, WindowsMetadataDict, UnixMetadataDict, LinkTargetDict, HashResultDict -- mirroring what dazzle-filekit actually produces |
dazzle_lib.exceptions |
DazzleError root + per-domain bases (PathIdentityError, FileOperationError, LinkError, PreserveError) |
dazzle_lib.mixins |
DazzleDataMixin -- derives to_json/summary/__str__ from your to_dict |
The idea: the dict is the interface
Rich objects in upper layers know how to become plain dicts; lower-layer functions take and return those dicts. The TypedDicts here are the agreed shapes, so a manifest object in dazzle-preservelib and a metadata collector in dazzle-filekit speak the same payload without sharing a class hierarchy:
from dataclasses import dataclass
from dazzle_lib import DazzleDataMixin, Serializable, FileMetadataDict
@dataclass
class TransferResult(DazzleDataMixin):
SCHEMA_VERSION = 1
path: str
metadata: FileMetadataDict
def to_dict(self):
return {"schema_version": self.SCHEMA_VERSION,
"path": self.path, "metadata": dict(self.metadata)}
@classmethod
def from_dict(cls, data):
return cls(path=data["path"], metadata=data["metadata"])
result = TransferResult("a.txt", {"mode": 0o644, "size": 10, "timestamps": {}})
assert isinstance(result, Serializable) # structural -- no subclassing needed
print(result.summary()) # one-liner for logs
And one catchable root for the whole stack:
from dazzle_lib import DazzleError
try:
... # any dazzle-* library call
except DazzleError as e:
... # caught, whichever layer raised it
The charter (enforced by tests)
This package is stdlib-only forever and contains no behavior. tests/test_charter.py fails on any banned import (os, shutil, pathlib, subprocess, ...) anywhere in the package -- a PR that needs to weaken that test is adding something that belongs in a higher layer. Admission follows the rule of two: a Protocol or TypedDict enters the bedrock only when two or more stack libraries need it.
The stack
| Layer | Library | Role |
|---|---|---|
| B | dazzle-lib (this) | bedrock contracts |
| L0 | dazzle-unctools | path identity (UNC/drive/origin) |
| L1 | dazzle-filekit | filesystem primitives |
| L2 | dazzle-linklib (planned) | link serialization |
| L3 | dazzle-preservelib (planned) | operation orchestration |
| ⊥ | dazzle-treelib | traversal engine |
Full architecture contract: STACK-MAP.md. API stability policy: docs/api-stability.md.
Development
pip install -e ".[dev]"
python -m pytest tests/ -v
License
MIT -- the bedrock sits beneath MIT and GPL stack members alike, so it carries the permissive license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dazzle_lib-0.1.0.tar.gz.
File metadata
- Download URL: dazzle_lib-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5364d2f2f9d090ac845e0778ff4603ae14c0af19c2141fca1dcb38a0bd770fcf
|
|
| MD5 |
f1d97e64208f6d0b924b58d1fabc0e63
|
|
| BLAKE2b-256 |
ca77053aa851f172c217e935b83a7849804ef1885c47bc6c1a72e9f609672ba5
|
Provenance
The following attestation bundles were made for dazzle_lib-0.1.0.tar.gz:
Publisher:
release.yml on DazzleLib/dazzle-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dazzle_lib-0.1.0.tar.gz -
Subject digest:
5364d2f2f9d090ac845e0778ff4603ae14c0af19c2141fca1dcb38a0bd770fcf - Sigstore transparency entry: 1793347784
- Sigstore integration time:
-
Permalink:
DazzleLib/dazzle-lib@f5f92c14810e40605151efc80666a342802b4931 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DazzleLib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f5f92c14810e40605151efc80666a342802b4931 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dazzle_lib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dazzle_lib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
307b5acb512167b5a0db654eb552f37db9ca76d055f164a574ad4a8ba69806b0
|
|
| MD5 |
7aeab2fa1fe25de1f04362bdcdccca8e
|
|
| BLAKE2b-256 |
60ed85f5a358e6f54a0f1425cb21e8dae85cd2d11a76d5cc81e55d3cd8cf3622
|
Provenance
The following attestation bundles were made for dazzle_lib-0.1.0-py3-none-any.whl:
Publisher:
release.yml on DazzleLib/dazzle-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dazzle_lib-0.1.0-py3-none-any.whl -
Subject digest:
307b5acb512167b5a0db654eb552f37db9ca76d055f164a574ad4a8ba69806b0 - Sigstore transparency entry: 1793347858
- Sigstore integration time:
-
Permalink:
DazzleLib/dazzle-lib@f5f92c14810e40605151efc80666a342802b4931 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DazzleLib
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f5f92c14810e40605151efc80666a342802b4931 -
Trigger Event:
push
-
Statement type: