spatialdata-js-util 0.1.0__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.
Files changed (40) hide show
  1. spatialdata_js_util/__init__.py +107 -0
  2. spatialdata_js_util/cli.py +803 -0
  3. spatialdata_js_util/codecs/__init__.py +67 -0
  4. spatialdata_js_util/codecs/backends.py +250 -0
  5. spatialdata_js_util/codecs/chunks.py +40 -0
  6. spatialdata_js_util/codecs/encoding.py +154 -0
  7. spatialdata_js_util/codecs/htj2k_wasm.py +266 -0
  8. spatialdata_js_util/codecs/names.py +26 -0
  9. spatialdata_js_util/codecs/probe/multicomponent.j2c +0 -0
  10. spatialdata_js_util/codecs/probe/multicomponent.json +3 -0
  11. spatialdata_js_util/codecs/probe/multicomponent.npy +0 -0
  12. spatialdata_js_util/codecs/vendor/__init__.py +1 -0
  13. spatialdata_js_util/codecs/vendor/encode-plane.mjs +164 -0
  14. spatialdata_js_util/codecs/vendor/openjph/index.mjs +131 -0
  15. spatialdata_js_util/codecs/vendor/openjph/wasm/libopenjph.mjs +2 -0
  16. spatialdata_js_util/codecs/vendor/openjph/wasm/libopenjph.wasm +0 -0
  17. spatialdata_js_util/codecs/vendor/openjph/wasm/libopenjph_simd.mjs +2 -0
  18. spatialdata_js_util/codecs/vendor/openjph/wasm/libopenjph_simd.wasm +0 -0
  19. spatialdata_js_util/codecs/zarr_codec.py +149 -0
  20. spatialdata_js_util/errors.py +5 -0
  21. spatialdata_js_util/images.py +849 -0
  22. spatialdata_js_util/index_permutations.py +311 -0
  23. spatialdata_js_util/points.py +445 -0
  24. spatialdata_js_util/points_zarr.py +799 -0
  25. spatialdata_js_util/provenance.py +17 -0
  26. spatialdata_js_util/pyramids.py +318 -0
  27. spatialdata_js_util/runners.py +458 -0
  28. spatialdata_js_util/store.py +305 -0
  29. spatialdata_js_util/tables.py +310 -0
  30. spatialdata_js_util/tui/__init__.py +0 -0
  31. spatialdata_js_util/tui/app.py +112 -0
  32. spatialdata_js_util/tui/models.py +45 -0
  33. spatialdata_js_util/tui/screens.py +1255 -0
  34. spatialdata_js_util/tui/widgets.py +50 -0
  35. spatialdata_js_util/verify.py +338 -0
  36. spatialdata_js_util-0.1.0.dist-info/METADATA +412 -0
  37. spatialdata_js_util-0.1.0.dist-info/RECORD +40 -0
  38. spatialdata_js_util-0.1.0.dist-info/WHEEL +5 -0
  39. spatialdata_js_util-0.1.0.dist-info/entry_points.txt +7 -0
  40. spatialdata_js_util-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,112 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from textual.app import App
6
+
7
+ from .models import WriterContext
8
+
9
+ if TYPE_CHECKING:
10
+ from .screens import HomeScreen
11
+
12
+
13
+ class WriterApp(App[None]):
14
+ CSS = """
15
+ Screen {
16
+ align: center middle;
17
+ }
18
+
19
+ .screen-title {
20
+ width: 100%;
21
+ content-align: center middle;
22
+ padding: 1 0;
23
+ text-style: bold;
24
+ }
25
+
26
+ .section-label {
27
+ padding-top: 1;
28
+ text-style: bold;
29
+ }
30
+
31
+ #command-list {
32
+ width: 70;
33
+ height: auto;
34
+ max-height: 16;
35
+ border: solid $accent;
36
+ margin: 1 0;
37
+ }
38
+
39
+ #points-key-list {
40
+ width: 70;
41
+ height: auto;
42
+ max-height: 12;
43
+ border: solid $accent;
44
+ margin: 1 0;
45
+ }
46
+
47
+ VerticalScroll {
48
+ width: 80;
49
+ height: 1fr;
50
+ border: solid $primary;
51
+ padding: 1 2;
52
+ }
53
+
54
+ Input {
55
+ margin-bottom: 1;
56
+ }
57
+
58
+ #run-log {
59
+ width: 90;
60
+ height: 1fr;
61
+ border: solid $accent;
62
+ margin: 1 0;
63
+ }
64
+
65
+ #verify-table {
66
+ width: 100%;
67
+ height: auto;
68
+ max-height: 14;
69
+ margin: 1 0;
70
+ }
71
+
72
+ #confirm-message {
73
+ width: 80;
74
+ padding: 1 2;
75
+ border: solid $warning;
76
+ margin: 1 0;
77
+ }
78
+
79
+ Horizontal {
80
+ width: auto;
81
+ height: auto;
82
+ align: center middle;
83
+ }
84
+
85
+ Button {
86
+ margin: 0 1;
87
+ }
88
+ """
89
+
90
+ BINDINGS = [("q", "quit", "Quit")]
91
+
92
+ def __init__(self, *, initial_zarr: str | None = None) -> None:
93
+ super().__init__()
94
+ self.context = WriterContext(zarr_path=initial_zarr)
95
+ self.home_screen: HomeScreen | None = None
96
+
97
+ def on_mount(self) -> None:
98
+ from .screens import HomeScreen
99
+
100
+ self.home_screen = HomeScreen()
101
+ self.install_screen(self.home_screen, "home")
102
+ self.push_screen("home")
103
+
104
+ def go_home(self) -> None:
105
+ if self.home_screen is None:
106
+ return
107
+ self.switch_screen("home")
108
+
109
+
110
+ def run_tui(*, initial_zarr: str | None = None) -> None:
111
+ app = WriterApp(initial_zarr=initial_zarr)
112
+ app.run()
@@ -0,0 +1,45 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from enum import Enum
5
+ from pathlib import Path
6
+ from typing import Any, Callable, Literal
7
+
8
+
9
+ class CommandId(str, Enum):
10
+ """Values mirror the `spatialdata-js-util` CLI paths the screens wrap."""
11
+
12
+ # images
13
+ RECOMPRESS = "images recompress"
14
+ # points
15
+ LIST_POINTS = "points list"
16
+ MORTON_FROM_ZARR = "points morton-from-zarr"
17
+ MORTON_POINTS = "points morton"
18
+ MULTISCALE_POINTS = "points multiscale"
19
+ INDEX_PERMUTATIONS = "points index-permutations"
20
+ # tables
21
+ LIST_TABLES = "tables list"
22
+ TABLES_TO_CSC = "tables to-csc"
23
+ # codecs
24
+ CODECS_INFO = "codecs info"
25
+
26
+
27
+ VerifyKind = Literal["none", "morton", "multiscale", "manifest"]
28
+
29
+
30
+ @dataclass
31
+ class TaskSpec:
32
+ command: CommandId
33
+ title: str
34
+ runner: Callable[[], dict[str, Any]]
35
+ verify_kind: VerifyKind = "none"
36
+ verify_paths: list[Path] = field(default_factory=list)
37
+ requires_confirm: bool = False
38
+ confirm_message: str = ""
39
+ log_lines: list[str] = field(default_factory=list)
40
+
41
+
42
+ @dataclass
43
+ class WriterContext:
44
+ zarr_path: str | None = None
45
+ points_key: str | None = None