Edit on GitHub

starplast.packs

Versioned, hash-checked data packs stored outside the installed application.

Packs contain data only. Installation validates every member before atomically changing the active version. Downloading requires an independently supplied SHA256; the embedded manifest checks integrity, not the publisher's identity. No network access occurs at import or lookup.

MAX_ARCHIVE_BYTES = 536870912
MAX_UNPACKED_BYTES = 1073741824
MANIFEST = 'manifest.json'
def digest(path) -> str:

SHA256 of a file, read in bounded chunks.

def root(code: str) -> pathlib.Path:

Writable directory containing this organism's versions and active pointer.

def build( space, version: str, files: dict, column_licenses: dict, destination) -> str:

Create a data archive and return its SHA256; validate tables before calling this function.

def verify(archive_path, expected_sha256: str | None = None) -> dict:

Validate the entire archive, including paths, member types, sizes and checksums.

def installed(code: str, version: str | None = None) -> pathlib.Path | None:

Resolve an installed version, or None; a malformed active pointer fails explicitly.

def install( archive_path, expected_sha256: str | None = None, organism: str | None = None) -> pathlib.Path:

Verify and install a version, then atomically activate it; never overwrite a version.

def download( url: str, expected_sha256: str, organism: str | None = None) -> pathlib.Path:

Download an HTTPS pack with a trusted checksum and a bounded size, then install it.

def main(argv=None):

Inspect, install or download a data pack without starting the desktop application.