framework-py 0.1.0.dev19__py3-none-any.whl → 0.1.0.dev20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -436,7 +436,7 @@ def _push_apply(root: Path, plan: dict[str, Any], server: str) -> dict[str, Any]
436
436
  for key in ("added", "changed", "removed")
437
437
  if done.get(key)
438
438
  ]
439
- inform(f"Data registry pushed: revision {revision} ({', '.join(parts)})")
439
+ inform(f"✓ Data registry pushed: revision {revision} ({', '.join(parts)})")
440
440
  else:
441
441
  inform("Already up to date.")
442
442
  return {"applied": bool(reply.get("applied")), "revision": revision}
framework/skill_sync.py CHANGED
@@ -76,10 +76,17 @@ def validate(files: list[dict[str, Any]]) -> list[dict[str, Any]]:
76
76
  return sorted(result, key=lambda f: f["path"])
77
77
 
78
78
 
79
+ def hash_bytes(raw: bytes) -> bytes:
80
+ """Text files hash with LF line endings, so a CRLF checkout (git's
81
+ core.autocrlf on Windows) matches its LF twin. A file with a NUL byte is
82
+ binary and hashes raw. R, Go, and Cloud normalize the same way."""
83
+ return raw if b"\0" in raw else raw.replace(b"\r\n", b"\n")
84
+
85
+
79
86
  def bundle_hash(files: list[dict[str, Any]]) -> str:
80
87
  manifest = "framework-skill-bundle-v1\n"
81
88
  for file in validate(files):
82
- raw = base64.b64decode(file["content"])
89
+ raw = hash_bytes(base64.b64decode(file["content"]))
83
90
  manifest += (
84
91
  f"{file['path']}\t{hashlib.sha256(raw).hexdigest()}\t"
85
92
  f"{755 if file['executable'] else 644}\t{len(raw)}\n"
@@ -240,6 +247,22 @@ def _install(
240
247
  # Backups retain the replaced bytes for recovery and explicit conflict resolution.
241
248
 
242
249
 
250
+ def _project_token(root: Path, server: str) -> str | None:
251
+ """The project's token when the project is on this server, else None.
252
+
253
+ A push that names the project lets Cloud list a pushed copy of a built-in
254
+ skill in the project's setup, so the next pull keeps it.
255
+ """
256
+ from framework.cloud import cloud_server, project_token
257
+
258
+ token = project_token(root)
259
+ if not token:
260
+ return None
261
+ if cloud_server(scope="project", project_dir=root).url.rstrip("/") != server:
262
+ return None
263
+ return token
264
+
265
+
243
266
  def skills_sync(
244
267
  path: str,
245
268
  project_path: str | Path = ".",
@@ -376,20 +399,17 @@ def skills_sync(
376
399
  entry["pending"] = pending
377
400
  state["skills"][key] = entry
378
401
  _save(root, state) # Retry identity survives a lost HTTP response.
379
- remote = api(
380
- "/api/v1/skills/sync",
381
- token,
382
- server,
383
- method="POST",
384
- body={
385
- "request_id": pending["request_id"],
386
- "skill_id": remote["skill_id"] if remote else None,
387
- "expected_version": expected,
388
- "variant": variant,
389
- "bundle": files,
390
- "client": {"app": "framework-py"},
391
- },
392
- )
402
+ body = {
403
+ "request_id": pending["request_id"],
404
+ "skill_id": remote["skill_id"] if remote else None,
405
+ "expected_version": expected,
406
+ "variant": variant,
407
+ "bundle": files,
408
+ "client": {"app": "framework-py"},
409
+ }
410
+ if named := _project_token(root, server):
411
+ body["project_token"] = named
412
+ remote = api("/api/v1/skills/sync", token, server, method="POST", body=body)
393
413
  if remote:
394
414
  if bundle_hash(remote["bundle"]) != remote["hash"]:
395
415
  raise ValueError("Cloud skill verification failed")
@@ -450,9 +470,7 @@ def shipped_release(target: Path, name: str) -> bool:
450
470
  return False
451
471
  raw = base64.b64decode(files[0]["content"])
452
472
  known = set(_shipped_history().get(name) or [])
453
- return any(
454
- hashlib.sha256(data).hexdigest() in known for data in (raw, raw.replace(b"\r\n", b"\n"))
455
- )
473
+ return any(hashlib.sha256(data).hexdigest() in known for data in (raw, hash_bytes(raw)))
456
474
 
457
475
 
458
476
  def package_status(source: Traversable, root: Path, relative: str, name: str) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: framework-py
3
- Version: 0.1.0.dev19
3
+ Version: 0.1.0.dev20
4
4
  Summary: Structured data science projects: a data catalog, integrity tracking, caching, outputs, and AI guardrails
5
5
  Project-URL: Homepage, https://framework.pub
6
6
  Project-URL: Source, https://github.com/frameworktools/framework-py
@@ -31,7 +31,7 @@ framework/connections.py,sha256=VUtT1kU3Z1kMxcYGnEzaEwgCvjeU5E71PxJAt8Ppzyw,3274
31
31
  framework/console.py,sha256=zQ0LuFDcxe1W1kuc5E1bJ03h8d3cvwFoqDT8dAJQyN0,1267
32
32
  framework/create.py,sha256=XTLUsMu2PpVhBB9k3spSNJZSDzshY-3JOcLJJost7ho,52576
33
33
  framework/data.py,sha256=5EwVKFwXABIhbEuf2MsvS8v_yJJ27upG0itSYA6N5mo,31557
34
- framework/data_registry.py,sha256=1sAFnYpwQ4HThFOMm2uZ8CReriSPb8DM5shaQ1Pgn7M,22492
34
+ framework/data_registry.py,sha256=EOR6eD2xH9BoCKtAjWjnu6XRofqG0v3DnpOkmeaPPWI,22496
35
35
  framework/db.py,sha256=Wruez2V352xA3gjk5RcUi_0zncFsDwTs9Gwa2hXBY3Y,8099
36
36
  framework/display.py,sha256=0FuKUt67uf5h1WjD4bwzoruc2XAN4y_j3mz_f5FskhE,5334
37
37
  framework/dotenv.py,sha256=6YQVR8d0CnHXHAYxvP3E4Am4Ei9mzqN2g63w_ft7qa0,4642
@@ -52,7 +52,7 @@ framework/scratch.py,sha256=idxthUR5BIMX7FIGS7KzIuhOrO3-HKLbBsV8It3EEE4,3890
52
52
  framework/security.py,sha256=-x66bSIIE_xOzkTf5Ojt7xIECKuAIpKVJZ5TtIGrwys,51147
53
53
  framework/settings.py,sha256=Sb2YyE53aYLWPj423P-pQVCvRpLsiHydgZh2K0luTQQ,23893
54
54
  framework/skill_pull.py,sha256=E6N1kMLJAww_wt-kSSNWhcqu-KOsago1C8ClqQ-XHlY,21669
55
- framework/skill_sync.py,sha256=2QfOBPbUH07qr7Bqm-sGvMuvcMHm53YiDlu3Dob30CE,22218
55
+ framework/skill_sync.py,sha256=0gqaeVkiNaqGJxmrVrKrYaX8wI3DNFZUsJEgG63xcKc,23060
56
56
  framework/storage.py,sha256=Jt8_adVwWMQmASzSUb97gLEMWz2GlmDUJmPgoYSgOBU,55485
57
57
  framework/sync_all.py,sha256=lRtXNbirHh45EcHpZnYPIQ7v4ahzGSENlBLfbx0i5vE,34422
58
58
  framework/upgrade.py,sha256=WtghpLR65YFH_JQFmo1JlH9lHdwsXQd-ZzzOTmyOL28,65593
@@ -128,7 +128,7 @@ framework/templates/stubs/notebook-default.qmd,sha256=8Js1S2BcHYeQWmJS-kt31gBvIj
128
128
  framework/templates/stubs/notebook-minimal.qmd,sha256=2U2k8judffhrh_6m6r6OAbQBCYEtViAjeKRBqBYCJTM,178
129
129
  framework/templates/stubs/notebook-revealjs.qmd,sha256=_ztT_gHoudpB5DIjlbvtB5zQ8163DeV8xbWcT-HgJrI,409
130
130
  framework/templates/stubs/script-default.py,sha256=vbWqgW0_rHot17mQC3tYb92g_9L-cbTOeL3y99BRrSk,216
131
- framework_py-0.1.0.dev19.dist-info/METADATA,sha256=PmcJ2cpZSAaGnklrykkNwmGccmTVPalgp6CfgLS2Me4,4647
132
- framework_py-0.1.0.dev19.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
133
- framework_py-0.1.0.dev19.dist-info/licenses/LICENSE,sha256=giOOgSwALkZimC7uhLZQK8Untez641bLW1-2-Cjvmq0,1072
134
- framework_py-0.1.0.dev19.dist-info/RECORD,,
131
+ framework_py-0.1.0.dev20.dist-info/METADATA,sha256=4qJank_bGrCAoROjR7npFuxWjCNSxYkhdzE27t-5vgA,4647
132
+ framework_py-0.1.0.dev20.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
133
+ framework_py-0.1.0.dev20.dist-info/licenses/LICENSE,sha256=giOOgSwALkZimC7uhLZQK8Untez641bLW1-2-Cjvmq0,1072
134
+ framework_py-0.1.0.dev20.dist-info/RECORD,,