"""Upload a file as a run artifact and verify the returned digest. The server stores the object under ``storage.`` (or the dev stack's object store); the returned artifact document carries the sha256. python artifact_upload.py """ import hashlib import tempfile from pathlib import Path import launchhelm payload = bytes((i * 31) % 256 for i in range(256 * 1024)) expected = hashlib.sha256(payload).hexdigest() with tempfile.TemporaryDirectory() as tmp: path = Path(tmp) / "weights.bin" path.write_bytes(payload) with launchhelm.init("quickstart", name="artifact-demo") as run: artifact = run.artifact(path, step=0, name="weights") print("artifact:", artifact.id) print("sha256 match:", artifact.spec.get("sha256") == expected)