an 0.1.331__py3-none-any.whl → 0.1.332__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.
an/audio/voice_design.py CHANGED
@@ -1318,19 +1318,9 @@ def _project_reels(project_dir: str | Path, scene_file: Any = DEFAULT_SCENE_FILE
1318
1318
  from an.ir.sync import resolve_scene_file
1319
1319
  from an.stores.artifacts import _BlobStore
1320
1320
 
1321
- class _WavStore(_BlobStore):
1321
+ class _WavStore(_BlobStore): # writes atomically, as every blob store (an#665)
1322
1322
  EXT = "wav"
1323
1323
 
1324
- def __setitem__(self, key: str, value: bytes) -> None:
1325
- # Whole or not at all (an#649): a reel a record says is current is
1326
- # never half written. Only here: on Windows a replace onto a file
1327
- # another handle holds is refused, which a render's output can be.
1328
- from dol import atomic_write
1329
-
1330
- p = self._path(key)
1331
- p.parent.mkdir(parents=True, exist_ok=True)
1332
- atomic_write(p, bytes(value))
1333
-
1334
1324
  sf = resolve_scene_file(project_dir, scene_file)
1335
1325
  return _WavStore(Path(project_dir) / sf.per_scene_dir(AUDITIONS_DIR))
1336
1326
 
an/render.py CHANGED
@@ -646,9 +646,10 @@ def _render_film(
646
646
  else:
647
647
  _ffmpeg_concat([r.mp4_path for r in shot_results], output_path)
648
648
 
649
- # Also write to the output store for parity with other artifacts.
650
- with open(output_path, "rb") as f:
651
- project.mall["output"][output_name] = f.read()
649
+ # Also write to the output store for parity with other artifacts. Read and
650
+ # closed first: the store's file can be this very file, and Windows will not
651
+ # replace a file a handle still holds (an#665).
652
+ project.mall["output"][output_name] = Path(output_path).read_bytes()
652
653
 
653
654
  _write_caption_sidecar(
654
655
  project.mall, output_name, scene, captions, pages, fps=effective_fps
@@ -1487,8 +1488,8 @@ def _archive_shot(project: Project, shot: Shot, result: RenderResult) -> None:
1487
1488
  person to look at; nothing reads it back (pillar 11). The cache is
1488
1489
  ``mall["shot_cache"]``, keyed by content.
1489
1490
  """
1490
- with open(result.mp4_path, "rb") as f:
1491
- project.mall["shots"][shot.id] = f.read()
1491
+ # Read and closed before the store writes (an#665).
1492
+ project.mall["shots"][shot.id] = Path(result.mp4_path).read_bytes()
1492
1493
 
1493
1494
 
1494
1495
  def _resolve_parallel(parallel: int | str | None, *, n_shots: int) -> int:
an/stores/artifacts.py CHANGED
@@ -14,6 +14,8 @@ from collections.abc import MutableMapping
14
14
  from pathlib import Path
15
15
  from typing import Iterator
16
16
 
17
+ from dol import atomic_write
18
+
17
19
 
18
20
  class _BlobStore(MutableMapping):
19
21
  """Generic file-as-bytes store with a fixed extension.
@@ -41,7 +43,11 @@ class _BlobStore(MutableMapping):
41
43
  def __setitem__(self, key: str, value: bytes) -> None:
42
44
  p = self._path(key)
43
45
  p.parent.mkdir(parents=True, exist_ok=True)
44
- p.write_bytes(value)
46
+ # Whole or not at all (an#649, an#665): a reader, or a crash, never meets
47
+ # half a file under a name a record says is current. On Windows the
48
+ # replace is refused while another handle holds the file: a writer
49
+ # reads what it stores, and closes it, first.
50
+ atomic_write(p, bytes(value))
45
51
 
46
52
  def __delitem__(self, key: str) -> None:
47
53
  p = self._path(key)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: an
3
- Version: 0.1.331
3
+ Version: 0.1.332
4
4
  Summary: AI-driven structured animation in Python: scene.md to rendered video.
5
5
  Project-URL: Homepage, https://github.com/thorwhalen/an
6
6
  Project-URL: Repository, https://github.com/thorwhalen/an
@@ -28,7 +28,7 @@ an/project.py,sha256=sOruychUpcD8IiPWe_C-tzXvSW4ACzYD0_eH9IFBNuA,11142
28
28
  an/props.py,sha256=49s2TyzS0bdKv2cc1Hp6dU9X8KHE78OTJ3rCr5WcUdA,444
29
29
  an/props_cli.py,sha256=BTLqc2cYsfadUJn_iEju_27_SI3izfa2ORgFOE-Z_k4,2594
30
30
  an/raster.py,sha256=E3E1ZwlluqgozOtKlTwBxTrd159VTyBSr_28rWh0BlA,446
31
- an/render.py,sha256=3H-jf8V3ay0j37BeeUB0QSR6mEgHnLlULJpmpWzWk14,64176
31
+ an/render.py,sha256=H8rbACPCT0U18fE1og1-7fGbIg7CINtTOp31LLNCR3k,64332
32
32
  an/sound_anchors.py,sha256=RmdwLNfYye5TZOfsuYx5CTDs4aaT_R_KaseUpCAjaR8,9125
33
33
  an/sound_fetch.py,sha256=ib60UlOkdHRX975AfhIKXTl5XTaXz__k2yzMu7_H7tE,8552
34
34
  an/sounds.py,sha256=ywUV7yCgRUGbgqxFFgviyWsxFAHh7BtTQiUdk8EzNPc,14929
@@ -75,7 +75,7 @@ an/audio/shared_mixing.py,sha256=VoP1UiIOO9K3y9FNwNmvwo_y2Dq7WGnRr9Gl8ArQwHU,425
75
75
  an/audio/takes.py,sha256=KM02NKGyJa-kdr8Rn2KkDr0t7MB4s9qTh8HOOPxoBo8,27693
76
76
  an/audio/transcripts.py,sha256=JJxu4vtjVUT63ULyAB6bJy4sqxGN14qhAwjq8qMo85k,29645
77
77
  an/audio/tts.py,sha256=YPgqBfmFUykfrILGRMgvIouoIShI9ZX2iFPqO3RXurc,1938
78
- an/audio/voice_design.py,sha256=xH6pb6WWk0aqiEfvETxdLf8-ul163NthZBK2CspZXZA,86383
78
+ an/audio/voice_design.py,sha256=SPBdogNAgKjUlopyiEHvX14aw5zbR45W03kBnd6WGts,85962
79
79
  an/audio/voices.py,sha256=3Vwxc4WxRLCr_Bvhs9joeSzZH-0R7zjPuIzq-UPu-9s,7237
80
80
  an/bench/__init__.py,sha256=1w7hYb0UTAsgX0BdEmgYaKIVowg8kLBMlROAkCjIrv8,3305
81
81
  an/bench/capture.py,sha256=uYEk5V6YgKXb1ZWQ9sQBLYAMR5V55j4MY88zM76o-Kk,12596
@@ -212,7 +212,7 @@ an/stage/world.py,sha256=lD8wz83GfNBON1y8edVqpi2ieh1Zed81_sWTQdez2nE,16631
212
212
  an/stage/runtime/__init__.py,sha256=N7xoZe2_tSnatwFpgmTM29qalMEGTSDad5VOm8Ducic,61
213
213
  an/stores/__init__.py,sha256=TweA1bmzOSKehKTseq8nhF_r2y40r_91tYplGf3WjEk,8004
214
214
  an/stores/_common.py,sha256=Lg_YOCjNY_Y3fxh26AzCgcewt-ZXOD41iCHwnRFu_tk,17398
215
- an/stores/artifacts.py,sha256=0o1HG2PVpcLB3SF2CVdJNjQZbTvPPntGC_y2QekU4ik,4452
215
+ an/stores/artifacts.py,sha256=D65Le-fltKBrHKcwcr0FrG6TixIO1XajwzfC-Be5c0M,4778
216
216
  an/stores/characters.py,sha256=dyr_uAEYnn1fYGfFiTY2ffIts12MMjEi5tW-iiwNP7I,746
217
217
  an/stores/decisions.py,sha256=-5DHX1aQLA3HzvXMtmyRZr7MUf8F9e13g6OHtsyJKFw,2900
218
218
  an/stores/environments.py,sha256=mR2ZUCj2r8SUYzzMJ4lEUn3SJg0zYCRM5roWz6tk3Gc,265
@@ -255,8 +255,8 @@ an/stage/runtime/preview.html,sha256=lXSPUkNMxRZd_36QKcpXjDICKgaBVcyPDlcvtzz7mgk
255
255
  an/stage/runtime/runtime.js,sha256=QkGtkD4zzJzuF0X7yxObP6_HN17Jqa1IDQEUDmtGAyA,120572
256
256
  an/stage/runtime/vendor/pixi.LICENSE.txt,sha256=XOdEe8V_c0n_xIM4eC-8q-YTaW4AcSsg1mvFjngPlHM,1092
257
257
  an/stage/runtime/vendor/pixi.min.js,sha256=ndupzXi8hhCh1EXsk5OTiIvoOSXHjkDWbZoX6YRQIo0,456133
258
- an-0.1.331.dist-info/METADATA,sha256=tH5OpL3drXHtjXoZWsxNipdj3T7pDltJiYQzQEZQNX0,16721
259
- an-0.1.331.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
260
- an-0.1.331.dist-info/entry_points.txt,sha256=pxmm-Jwfy3M7TfCytk972KqAV3g8MQasouKp1tTmvLI,40
261
- an-0.1.331.dist-info/licenses/LICENSE,sha256=ekE13yCE9fWWEJfP1NPnUJabZ_Wwrc6coKJV2ZZx27w,1068
262
- an-0.1.331.dist-info/RECORD,,
258
+ an-0.1.332.dist-info/METADATA,sha256=CPhSRyRaHbKM0q4-iWIvs1v3reDgD-KvcWsG7azt09M,16721
259
+ an-0.1.332.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
260
+ an-0.1.332.dist-info/entry_points.txt,sha256=pxmm-Jwfy3M7TfCytk972KqAV3g8MQasouKp1tTmvLI,40
261
+ an-0.1.332.dist-info/licenses/LICENSE,sha256=ekE13yCE9fWWEJfP1NPnUJabZ_Wwrc6coKJV2ZZx27w,1068
262
+ an-0.1.332.dist-info/RECORD,,
File without changes