moops 0.12.2__tar.gz → 0.13.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.
- {moops-0.12.2 → moops-0.13.0}/PKG-INFO +3 -1
- {moops-0.12.2 → moops-0.13.0}/pyproject.toml +3 -1
- {moops-0.12.2 → moops-0.13.0}/src/moops/group.py +39 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/interface.py +12 -5
- {moops-0.12.2 → moops-0.13.0}/README.md +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/__init__.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_choice_options.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_control_mirroring.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_custom_element.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_embed.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_input_map.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_interface_utils.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_list_controls.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_list_options.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_marimo_controls.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_markdown.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_naming.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_options.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_parse.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_preset_state.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_presets_ui.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_query_params.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_run.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_run_button.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_subgroup_registry.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_terminal_graphics.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_text_wrap.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_ui_workarounds.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_value_resolution.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/_variant.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/presets.py +0 -0
- {moops-0.12.2 → moops-0.13.0}/src/moops/workarounds.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: moops
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.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
|
|
@@ -13,11 +13,13 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
15
15
|
Requires-Dist: marimo>=0.23.1
|
|
16
|
+
Requires-Dist: tabulate>=0.10.0 ; extra == 'table'
|
|
16
17
|
Requires-Dist: hypothesis ; extra == 'test'
|
|
17
18
|
Requires-Python: >=3.10
|
|
18
19
|
Project-URL: Homepage, https://github.com/yairchu/moops
|
|
19
20
|
Project-URL: Repository, https://github.com/yairchu/moops
|
|
20
21
|
Project-URL: Issues, https://github.com/yairchu/moops/issues
|
|
22
|
+
Provides-Extra: table
|
|
21
23
|
Provides-Extra: test
|
|
22
24
|
Description-Content-Type: text/markdown
|
|
23
25
|
|
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "moops"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.13.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"
|
|
@@ -29,6 +29,8 @@ dependencies = [
|
|
|
29
29
|
[project.optional-dependencies]
|
|
30
30
|
# Interface.strategy() builds a Hypothesis strategy; only needed for testing.
|
|
31
31
|
test = ["hypothesis"]
|
|
32
|
+
# Group.table() uses pandas.to_markdown(), which requires tabulate for CLI output.
|
|
33
|
+
table = ["tabulate>=0.10.0"]
|
|
32
34
|
|
|
33
35
|
[project.urls]
|
|
34
36
|
Homepage = "https://github.com/yairchu/moops"
|
|
@@ -371,6 +371,45 @@ class Group:
|
|
|
371
371
|
_terminal_graphics.emit(_terminal_graphics.to_png(fig, dpi=dpi))
|
|
372
372
|
return None
|
|
373
373
|
|
|
374
|
+
def table(
|
|
375
|
+
self,
|
|
376
|
+
data: typing.Any,
|
|
377
|
+
**kwargs: typing.Any,
|
|
378
|
+
) -> typing.Any | None:
|
|
379
|
+
"""Display tabular data in notebooks or plain text in CLI."""
|
|
380
|
+
|
|
381
|
+
if self.is_interface_query or self.output_mode is None:
|
|
382
|
+
return None
|
|
383
|
+
if self.output_mode is OutputMode.NOTEBOOK:
|
|
384
|
+
return mo.ui.table(data, **kwargs)
|
|
385
|
+
format_mapping = kwargs.get("format_mapping", {})
|
|
386
|
+
if format_mapping:
|
|
387
|
+
if not hasattr(data, "copy"):
|
|
388
|
+
raise NotImplementedError(
|
|
389
|
+
"format_mapping is only supported for data types "
|
|
390
|
+
"with a copy() method, such as pandas DataFrames"
|
|
391
|
+
)
|
|
392
|
+
data = data.copy()
|
|
393
|
+
for column, format_value in format_mapping.items():
|
|
394
|
+
if column in data:
|
|
395
|
+
fn = format_value if callable(format_value) else format_value.format
|
|
396
|
+
data[column] = data[column].map(fn)
|
|
397
|
+
if hasattr(data, "to_markdown"):
|
|
398
|
+
try:
|
|
399
|
+
print(data.to_markdown(index=False))
|
|
400
|
+
except ImportError:
|
|
401
|
+
import warnings
|
|
402
|
+
|
|
403
|
+
warnings.warn(
|
|
404
|
+
"Install tabulate for formatted table output: pip install tabulate",
|
|
405
|
+
stacklevel=2,
|
|
406
|
+
)
|
|
407
|
+
print(data)
|
|
408
|
+
else:
|
|
409
|
+
print(data)
|
|
410
|
+
print()
|
|
411
|
+
return None
|
|
412
|
+
|
|
374
413
|
def _bool_control(
|
|
375
414
|
self,
|
|
376
415
|
widget: typing.Literal["switch", "checkbox"],
|
|
@@ -520,12 +520,19 @@ class Interface:
|
|
|
520
520
|
if missing_options
|
|
521
521
|
else ""
|
|
522
522
|
)
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
f"{
|
|
523
|
+
if any(self._input_controls(active_only=True)):
|
|
524
|
+
help_text = self.help()
|
|
525
|
+
usage = (
|
|
526
|
+
f"```\n{help_text}\n```\n"
|
|
527
|
+
if len(help_text.splitlines()) <= 3
|
|
528
|
+
else (
|
|
529
|
+
f"<details><summary>Usage</summary>\n\n"
|
|
530
|
+
f"```\n{help_text}\n```\n</details>\n"
|
|
531
|
+
)
|
|
527
532
|
)
|
|
528
|
-
|
|
533
|
+
body_items.append(mo.md(f"{usage}{missing_options_msg}"))
|
|
534
|
+
elif missing_options_msg:
|
|
535
|
+
body_items.append(mo.md(missing_options_msg))
|
|
529
536
|
items: list[typing.Any] = [mo.callout(mo.vstack(body_items), kind)]
|
|
530
537
|
if self._presets_ui is not None:
|
|
531
538
|
items.append(self._presets_ui.layout(args))
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|