moops 0.3.3__tar.gz → 0.4.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moops
3
- Version: 0.3.3
3
+ Version: 0.4.0
4
4
  Summary: Write Marimo notebooks that also work as CLI scripts, with unified UI controls
5
5
  Keywords: marimo,notebooks,cli,testing
6
6
  Author: Yair Chuchem
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "moops"
7
- version = "0.3.3"
7
+ version = "0.4.0"
8
8
  description = "Write Marimo notebooks that also work as CLI scripts, with unified UI controls"
9
9
  license = "MIT"
10
10
  readme = "README.md"
@@ -1,5 +1,6 @@
1
1
  from importlib.metadata import version
2
2
 
3
+ from ._embed import Passthrough, embed
3
4
  from ._run import run
4
5
  from ._run_button import run_button
5
6
  from .group import Group
@@ -8,4 +9,13 @@ from .presets import Presets
8
9
 
9
10
  __version__ = version("moops")
10
11
 
11
- __all__ = ["Group", "Interface", "Presets", "__version__", "run", "run_button"]
12
+ __all__ = [
13
+ "Group",
14
+ "Interface",
15
+ "Passthrough",
16
+ "Presets",
17
+ "__version__",
18
+ "embed",
19
+ "run",
20
+ "run_button",
21
+ ]
@@ -20,9 +20,9 @@ class _App(typing.Protocol):
20
20
  ) -> tuple[typing.Iterable[typing.Any], typing.Mapping[str, object]]: ...
21
21
 
22
22
 
23
- class App:
23
+ async def embed(app: _App, defs: dict[str, typing.Any] | None = None) -> typing.Any:
24
24
  """
25
- Wrap a marimo app with lean script-mode embeds.
25
+ Embed a marimo app, with lean script-mode embeds.
26
26
 
27
27
  In script mode, only the embedded notebook's ``result`` definition is
28
28
  retained, so intermediate definitions and rendered outputs can be released
@@ -31,17 +31,9 @@ class App:
31
31
  This also works around marimo nested embed failures in script mode,
32
32
  see https://github.com/marimo-team/marimo/issues/9572
33
33
  """
34
-
35
- def __init__(self, app: _App) -> None:
36
- self._app = app
37
-
38
- def clone(self) -> "App":
39
- return App(self._app.clone())
40
-
41
- async def embed(self, defs: dict[str, typing.Any] | None = None) -> typing.Any:
42
- if mo.running_in_notebook():
43
- return await self._app.embed(defs=defs)
44
- return await asyncio.to_thread(_embed_in_script, self._app, defs or {})
34
+ if mo.running_in_notebook():
35
+ return await app.embed(defs=defs)
36
+ return await asyncio.to_thread(_embed_in_script, app, defs or {})
45
37
 
46
38
 
47
39
  class Passthrough:
@@ -62,7 +54,7 @@ class Passthrough:
62
54
  unexpected = defs.keys() - {"args"}
63
55
  if unexpected:
64
56
  raise ValueError(
65
- f"moops.embed.Passthrough received unexpected defs keys: {unexpected}"
57
+ f"moops.Passthrough received unexpected defs keys: {unexpected}"
66
58
  )
67
59
  return self
68
60
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes