h2o-wave 0.26.3__py3-none-any.whl → 1.0.1__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.
Potentially problematic release.
This version of h2o-wave might be problematic. Click here for more details.
- h2o_wave/__init__.py +2 -2
- h2o_wave/cli.py +69 -49
- h2o_wave/core.py +35 -34
- h2o_wave/metadata.py +4 -3
- h2o_wave/routing.py +79 -11
- h2o_wave/server.py +7 -38
- h2o_wave/share.py +13 -4
- h2o_wave/types.py +222 -23
- h2o_wave/ui.py +86 -13
- h2o_wave/version.py +1 -1
- {h2o_wave-0.26.3.dist-info → h2o_wave-1.0.1.dist-info}/METADATA +33 -32
- h2o_wave-1.0.1.dist-info/RECORD +22 -0
- {h2o_wave-0.26.3.dist-info → h2o_wave-1.0.1.dist-info}/WHEEL +1 -2
- {h2o_wave-0.26.3.dist-info → h2o_wave-1.0.1.dist-info}/entry_points.txt +0 -1
- h2o_wave-0.26.3.data/data/project_templates/README.md +0 -41
- h2o_wave-0.26.3.data/data/project_templates/header.py +0 -85
- h2o_wave-0.26.3.data/data/project_templates/header_nav.py +0 -218
- h2o_wave-0.26.3.data/data/project_templates/header_sidebar_nav.py +0 -232
- h2o_wave-0.26.3.data/data/project_templates/hello_world.py +0 -69
- h2o_wave-0.26.3.data/data/project_templates/sidebar_nav.py +0 -227
- h2o_wave-0.26.3.dist-info/RECORD +0 -29
- h2o_wave-0.26.3.dist-info/top_level.txt +0 -1
- {h2o_wave-0.26.3.dist-info → h2o_wave-1.0.1.dist-info/licenses}/LICENSE +0 -0
h2o_wave/ui.py
CHANGED
|
@@ -58,7 +58,6 @@ def command(
|
|
|
58
58
|
icon: Optional[str] = None,
|
|
59
59
|
items: Optional[List[Command]] = None,
|
|
60
60
|
value: Optional[str] = None,
|
|
61
|
-
data: Optional[str] = None,
|
|
62
61
|
) -> Command:
|
|
63
62
|
"""Create a command.
|
|
64
63
|
|
|
@@ -71,12 +70,9 @@ def command(
|
|
|
71
70
|
icon: The icon to be displayed for this command.
|
|
72
71
|
items: Sub-commands, if any
|
|
73
72
|
value: Data associated with this command, if any.
|
|
74
|
-
data: DEPRECATED. Use `value` instead. Data associated with this command, if any.
|
|
75
73
|
Returns:
|
|
76
74
|
A `h2o_wave.types.Command` instance.
|
|
77
75
|
"""
|
|
78
|
-
if data is not None:
|
|
79
|
-
warnings.warn('The data argument is deprecated.')
|
|
80
76
|
return Command(
|
|
81
77
|
name,
|
|
82
78
|
label,
|
|
@@ -84,7 +80,6 @@ def command(
|
|
|
84
80
|
icon,
|
|
85
81
|
items,
|
|
86
82
|
value,
|
|
87
|
-
data,
|
|
88
83
|
)
|
|
89
84
|
|
|
90
85
|
|
|
@@ -1280,7 +1275,7 @@ def markdown_table_cell_type(
|
|
|
1280
1275
|
|
|
1281
1276
|
Args:
|
|
1282
1277
|
name: An identifying name for this component.
|
|
1283
|
-
target: Where to display the link.
|
|
1278
|
+
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
|
|
1284
1279
|
Returns:
|
|
1285
1280
|
A `h2o_wave.types.MarkdownTableCellType` instance.
|
|
1286
1281
|
"""
|
|
@@ -1510,7 +1505,7 @@ def link(
|
|
|
1510
1505
|
button: True if the link should be rendered as a button.
|
|
1511
1506
|
width: The width of the link, e.g. '100px'.
|
|
1512
1507
|
visible: True if the component should be visible. Defaults to True.
|
|
1513
|
-
target: Where to display the link.
|
|
1508
|
+
target: Where to display the link. An empty string or `'_blank'` opens the link in a new tab. `_self` opens in the current tab.
|
|
1514
1509
|
tooltip: An optional tooltip message displayed when a user clicks the help icon to the right of the component.
|
|
1515
1510
|
name: An identifying name for this component.
|
|
1516
1511
|
Returns:
|
|
@@ -2092,6 +2087,7 @@ def visualization(
|
|
|
2092
2087
|
visible: Optional[bool] = None,
|
|
2093
2088
|
events: Optional[List[str]] = None,
|
|
2094
2089
|
interactions: Optional[List[str]] = None,
|
|
2090
|
+
animate: Optional[bool] = None,
|
|
2095
2091
|
) -> Component:
|
|
2096
2092
|
"""Create a visualization for display inside a form.
|
|
2097
2093
|
|
|
@@ -2104,6 +2100,7 @@ def visualization(
|
|
|
2104
2100
|
visible: True if the component should be visible. Defaults to True.
|
|
2105
2101
|
events: The events to capture on this visualization. One of 'select_marks'.
|
|
2106
2102
|
interactions: The interactions to be allowed for this plot. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.
|
|
2103
|
+
animate: EXPERIMENTAL: True to turn on the chart animations. Defaults to False.
|
|
2107
2104
|
Returns:
|
|
2108
2105
|
A `h2o_wave.types.Visualization` instance.
|
|
2109
2106
|
"""
|
|
@@ -2116,6 +2113,7 @@ def visualization(
|
|
|
2116
2113
|
visible,
|
|
2117
2114
|
events,
|
|
2118
2115
|
interactions,
|
|
2116
|
+
animate,
|
|
2119
2117
|
))
|
|
2120
2118
|
|
|
2121
2119
|
|
|
@@ -2497,7 +2495,7 @@ def image_annotator(
|
|
|
2497
2495
|
trigger: True if the form should be submitted as soon as an annotation is drawn.
|
|
2498
2496
|
image_height: The card’s image height. The actual image size is used by default.
|
|
2499
2497
|
allowed_shapes: List of allowed shapes. Available values are 'rect' and 'polygon'. If not set, all shapes are available by default.
|
|
2500
|
-
events: The events to capture on this image annotator. One of `click`
|
|
2498
|
+
events: The events to capture on this image annotator. One of `click` | `tool_change`.
|
|
2501
2499
|
Returns:
|
|
2502
2500
|
A `h2o_wave.types.ImageAnnotator` instance.
|
|
2503
2501
|
"""
|
|
@@ -2514,6 +2512,80 @@ def image_annotator(
|
|
|
2514
2512
|
))
|
|
2515
2513
|
|
|
2516
2514
|
|
|
2515
|
+
def audio_annotator_tag(
|
|
2516
|
+
name: str,
|
|
2517
|
+
label: str,
|
|
2518
|
+
color: str,
|
|
2519
|
+
) -> AudioAnnotatorTag:
|
|
2520
|
+
"""Create a unique tag type for use in an audio annotator.
|
|
2521
|
+
|
|
2522
|
+
Args:
|
|
2523
|
+
name: An identifying name for this tag.
|
|
2524
|
+
label: Text to be displayed for the annotation.
|
|
2525
|
+
color: Hex or RGB color string to be used as the background color.
|
|
2526
|
+
Returns:
|
|
2527
|
+
A `h2o_wave.types.AudioAnnotatorTag` instance.
|
|
2528
|
+
"""
|
|
2529
|
+
return AudioAnnotatorTag(
|
|
2530
|
+
name,
|
|
2531
|
+
label,
|
|
2532
|
+
color,
|
|
2533
|
+
)
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
def audio_annotator_item(
|
|
2537
|
+
start: float,
|
|
2538
|
+
end: float,
|
|
2539
|
+
tag: str,
|
|
2540
|
+
) -> AudioAnnotatorItem:
|
|
2541
|
+
"""Create an annotator item with initial selected tags or no tags.
|
|
2542
|
+
|
|
2543
|
+
Args:
|
|
2544
|
+
start: The start of the audio annotation in seconds.
|
|
2545
|
+
end: The end of the audio annotation in seconds.
|
|
2546
|
+
tag: The `name` of the audio annotator tag to refer to for the `label` and `color` of this item.
|
|
2547
|
+
Returns:
|
|
2548
|
+
A `h2o_wave.types.AudioAnnotatorItem` instance.
|
|
2549
|
+
"""
|
|
2550
|
+
return AudioAnnotatorItem(
|
|
2551
|
+
start,
|
|
2552
|
+
end,
|
|
2553
|
+
tag,
|
|
2554
|
+
)
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
def audio_annotator(
|
|
2558
|
+
name: str,
|
|
2559
|
+
title: str,
|
|
2560
|
+
path: str,
|
|
2561
|
+
tags: List[AudioAnnotatorTag],
|
|
2562
|
+
items: Optional[List[AudioAnnotatorItem]] = None,
|
|
2563
|
+
trigger: Optional[bool] = None,
|
|
2564
|
+
) -> Component:
|
|
2565
|
+
"""Create an audio annotator component.
|
|
2566
|
+
|
|
2567
|
+
This component allows annotating and labeling parts of audio file.
|
|
2568
|
+
|
|
2569
|
+
Args:
|
|
2570
|
+
name: An identifying name for this component.
|
|
2571
|
+
title: The audio annotator's title.
|
|
2572
|
+
path: The path to the audio file. Use mp3 or wav formats to achieve the best cross-browser support. See https://caniuse.com/?search=audio%20format for other formats.
|
|
2573
|
+
tags: The master list of tags that can be used for annotations.
|
|
2574
|
+
items: Annotations to display on the image, if any.
|
|
2575
|
+
trigger: True if the form should be submitted as soon as an annotation is made.
|
|
2576
|
+
Returns:
|
|
2577
|
+
A `h2o_wave.types.AudioAnnotator` instance.
|
|
2578
|
+
"""
|
|
2579
|
+
return Component(audio_annotator=AudioAnnotator(
|
|
2580
|
+
name,
|
|
2581
|
+
title,
|
|
2582
|
+
path,
|
|
2583
|
+
tags,
|
|
2584
|
+
items,
|
|
2585
|
+
trigger,
|
|
2586
|
+
))
|
|
2587
|
+
|
|
2588
|
+
|
|
2517
2589
|
def facepile(
|
|
2518
2590
|
items: List[Component],
|
|
2519
2591
|
name: Optional[str] = None,
|
|
@@ -3701,6 +3773,7 @@ def meta_card(
|
|
|
3701
3773
|
script: Optional[InlineScript] = None,
|
|
3702
3774
|
stylesheet: Optional[InlineStylesheet] = None,
|
|
3703
3775
|
stylesheets: Optional[List[Stylesheet]] = None,
|
|
3776
|
+
animate: Optional[bool] = None,
|
|
3704
3777
|
commands: Optional[List[Command]] = None,
|
|
3705
3778
|
) -> MetaCard:
|
|
3706
3779
|
"""Represents page-global state.
|
|
@@ -3726,6 +3799,7 @@ def meta_card(
|
|
|
3726
3799
|
script: Javascript code to execute on this page.
|
|
3727
3800
|
stylesheet: CSS stylesheet to be applied to this page.
|
|
3728
3801
|
stylesheets: External CSS files to load into the page.
|
|
3802
|
+
animate: EXPERIMENTAL: True to turn on the card animations. Defaults to False.
|
|
3729
3803
|
commands: Contextual menu commands for this component.
|
|
3730
3804
|
Returns:
|
|
3731
3805
|
A `h2o_wave.types.MetaCard` instance.
|
|
@@ -3748,6 +3822,7 @@ def meta_card(
|
|
|
3748
3822
|
script,
|
|
3749
3823
|
stylesheet,
|
|
3750
3824
|
stylesheets,
|
|
3825
|
+
animate,
|
|
3751
3826
|
commands,
|
|
3752
3827
|
)
|
|
3753
3828
|
|
|
@@ -3834,6 +3909,7 @@ def plot_card(
|
|
|
3834
3909
|
plot: Plot,
|
|
3835
3910
|
events: Optional[List[str]] = None,
|
|
3836
3911
|
interactions: Optional[List[str]] = None,
|
|
3912
|
+
animate: Optional[bool] = None,
|
|
3837
3913
|
commands: Optional[List[Command]] = None,
|
|
3838
3914
|
) -> PlotCard:
|
|
3839
3915
|
"""Create a card displaying a plot.
|
|
@@ -3845,6 +3921,7 @@ def plot_card(
|
|
|
3845
3921
|
plot: The plot to be displayed in this card.
|
|
3846
3922
|
events: The events to capture on this card. One of 'select_marks'.
|
|
3847
3923
|
interactions: The interactions to be allowed for this card. One of 'drag_move' | 'scale_zoom' | 'brush'. Note: `brush` does not raise `select_marks` event.
|
|
3924
|
+
animate: EXPERIMENTAL: True to turn on the chart animations. Defaults to False.
|
|
3848
3925
|
commands: Contextual menu commands for this component.
|
|
3849
3926
|
Returns:
|
|
3850
3927
|
A `h2o_wave.types.PlotCard` instance.
|
|
@@ -3856,6 +3933,7 @@ def plot_card(
|
|
|
3856
3933
|
plot,
|
|
3857
3934
|
events,
|
|
3858
3935
|
interactions,
|
|
3936
|
+
animate,
|
|
3859
3937
|
commands,
|
|
3860
3938
|
)
|
|
3861
3939
|
|
|
@@ -4532,7 +4610,6 @@ def wide_article_preview_card(
|
|
|
4532
4610
|
title: str,
|
|
4533
4611
|
name: Optional[str] = None,
|
|
4534
4612
|
aux_value: Optional[str] = None,
|
|
4535
|
-
caption: Optional[str] = None,
|
|
4536
4613
|
items: Optional[List[Component]] = None,
|
|
4537
4614
|
content: Optional[str] = None,
|
|
4538
4615
|
commands: Optional[List[Command]] = None,
|
|
@@ -4546,15 +4623,12 @@ def wide_article_preview_card(
|
|
|
4546
4623
|
title: The card's title on the right-hand side
|
|
4547
4624
|
name: An identifying name for this card. Makes the card clickable, similar to a button.
|
|
4548
4625
|
aux_value: The card's auxiliary text, displayed on the right-hand side of the header.
|
|
4549
|
-
caption: DEPRECATED. Use `content` instead. The card's caption, displayed below the title on the right-hand side.
|
|
4550
4626
|
items: The card's buttons, displayed under the caption.
|
|
4551
4627
|
content: The card's markdown content, displayed below the title on the right-hand side.
|
|
4552
4628
|
commands: Contextual menu commands for this component.
|
|
4553
4629
|
Returns:
|
|
4554
4630
|
A `h2o_wave.types.WideArticlePreviewCard` instance.
|
|
4555
4631
|
"""
|
|
4556
|
-
if caption is not None:
|
|
4557
|
-
warnings.warn('The caption argument is deprecated.')
|
|
4558
4632
|
return WideArticlePreviewCard(
|
|
4559
4633
|
box,
|
|
4560
4634
|
persona,
|
|
@@ -4562,7 +4636,6 @@ def wide_article_preview_card(
|
|
|
4562
4636
|
title,
|
|
4563
4637
|
name,
|
|
4564
4638
|
aux_value,
|
|
4565
|
-
caption,
|
|
4566
4639
|
items,
|
|
4567
4640
|
content,
|
|
4568
4641
|
commands,
|
h2o_wave/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '0.
|
|
1
|
+
__version__ = '1.0.1'
|
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: h2o-wave
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.1
|
|
4
4
|
Summary: Python driver for H2O Wave Realtime Apps
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
Project-URL: Homepage, https://wave.h2o.ai/
|
|
6
|
+
Project-URL: Documentation, https://wave.h2o.ai/
|
|
7
|
+
Project-URL: Repository, https://github.com/h2oai/wave
|
|
8
|
+
Project-URL: Changelog, https://github.com/h2oai/wave/releases
|
|
9
|
+
Author-email: Prithvi Prabhu <prithvi@h2o.ai>
|
|
10
|
+
Maintainer-email: Martin Turoci <martin.turoci@h2o.ai>, Marek Mihok <marek.mihok@h2o.ai>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: Data Science,Low code,Machine Learning,Realtime,UI
|
|
13
14
|
Classifier: Development Status :: 5 - Production/Stable
|
|
14
15
|
Classifier: Intended Audience :: Developers
|
|
15
16
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
-
Classifier:
|
|
17
|
-
Classifier:
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
23
|
Classifier: Topic :: Communications :: Chat
|
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
19
25
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
20
26
|
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
21
27
|
Classifier: Topic :: Software Development :: Widget Sets
|
|
22
28
|
Classifier: Topic :: System :: Distributed Computing
|
|
23
|
-
Requires-Python: >=3.
|
|
24
|
-
Requires-Dist:
|
|
25
|
-
Requires-Dist: httpx
|
|
29
|
+
Requires-Python: >=3.8
|
|
30
|
+
Requires-Dist: click
|
|
31
|
+
Requires-Dist: httpx>=0.16.1
|
|
26
32
|
Requires-Dist: inquirer
|
|
27
|
-
Requires-Dist: starlette
|
|
28
|
-
Requires-Dist: uvicorn
|
|
29
|
-
|
|
30
|
-
Requires-Dist: h2o-wave-ml ; extra == 'ml'
|
|
33
|
+
Requires-Dist: starlette>=0.13.8
|
|
34
|
+
Requires-Dist: uvicorn>=0.17.6
|
|
35
|
+
Description-Content-Type: text/x-rst
|
|
31
36
|
|
|
32
37
|
H2O Wave
|
|
33
38
|
========
|
|
@@ -61,26 +66,24 @@ Hello world
|
|
|
61
66
|
|
|
62
67
|
.. code-block:: python
|
|
63
68
|
|
|
64
|
-
from h2o_wave import
|
|
69
|
+
from h2o_wave import main, app, Q, ui
|
|
65
70
|
|
|
66
|
-
# Access the web page at http://localhost:10101/demo
|
|
67
|
-
page = site['/demo']
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
@app('/')
|
|
73
|
+
async def serve(q: Q):
|
|
74
|
+
q.page['hello'] = ui.markdown_card(
|
|
75
|
+
box='1 1 3 3',
|
|
76
|
+
title='Hello world!',
|
|
77
|
+
content='Welcome to Wave!'
|
|
78
|
+
)
|
|
79
|
+
await q.page.save()
|
|
75
80
|
|
|
76
|
-
# Save the page
|
|
77
|
-
page.save()
|
|
78
81
|
|
|
79
82
|
Run ``hello.py``:
|
|
80
83
|
|
|
81
84
|
.. code-block:: text
|
|
82
85
|
|
|
83
|
-
$
|
|
86
|
+
$ wave run hello.py
|
|
84
87
|
|
|
85
88
|
|
|
86
89
|
Links
|
|
@@ -93,5 +96,3 @@ Links
|
|
|
93
96
|
|
|
94
97
|
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
h2o_wave/__init__.py,sha256=XIclw-HLtXgr0wNf5eQpkh6ZiqD9QAoiS-vZhp3IR5k,1674
|
|
2
|
+
h2o_wave/__main__.py,sha256=MoNOW43ppIqCdY3iq0n25Q3SKLyk8Igg5fD_sSROK4c,638
|
|
3
|
+
h2o_wave/cli.py,sha256=KPcHXIYdxoc5DMIHsyVSNgC1I9JgqJRtkpO0vEGwv_8,13424
|
|
4
|
+
h2o_wave/core.py,sha256=whFb-Z2wokNXe_39I8aL3i7JOx6eczRfWOkn5wb_YwM,39087
|
|
5
|
+
h2o_wave/db.py,sha256=H3W_EyMfnwr4UjqPVoAsE19O2QzY1ptIYGMOqU0YUQo,7489
|
|
6
|
+
h2o_wave/graphics.py,sha256=HLYrX-lwsMKbyLmy2ClG5L46DA2_hSCEPTsv0gPVoyg,25866
|
|
7
|
+
h2o_wave/ide.py,sha256=wAJjfEI1ekQrL455FGRVeNi3KiH6ELgsG3qm31Q-kRs,6810
|
|
8
|
+
h2o_wave/metadata.py,sha256=5UwOlmD6MsSqn0Px6RXzcKAfu4WRqOsS1M-OCf_gmkw,94
|
|
9
|
+
h2o_wave/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
h2o_wave/routing.py,sha256=de8GVfUAb6bwFXtsWj6NXmjMVGELknlZb03F-R4ManY,10592
|
|
11
|
+
h2o_wave/server.py,sha256=u80Jma83mMKqmTitVDFO703SrcC4Y29DQM2letSVNyA,17900
|
|
12
|
+
h2o_wave/share.py,sha256=2zgywet8540O6xM-JD3po1glyP2PBJ3lIxaWBJbQvtQ,1164
|
|
13
|
+
h2o_wave/test.py,sha256=hF_fS5e25bACnzENjpDrikv7nPOs0iENh4MuXX9BaVA,2738
|
|
14
|
+
h2o_wave/types.py,sha256=PKvvwDeQj9dqRyIwUVRtQpmnPVF0TI3gkLn8M4i7Y4E,645052
|
|
15
|
+
h2o_wave/ui.py,sha256=mJzYyqWsZ-_6dmwPdG8rdPRsIdtD3x_NS1jz1l1SJRg,168352
|
|
16
|
+
h2o_wave/ui_ext.py,sha256=zx_2Ec2-p_ztm8brfVaVF0fTQWVDrb_YxcGfVb-wA10,2325
|
|
17
|
+
h2o_wave/version.py,sha256=3KXfAcA5rzzQXMtfwpHphgbJNZdA0XWaW96kdWVSZJw,22
|
|
18
|
+
h2o_wave-1.0.1.dist-info/METADATA,sha256=uCgdpPbIo045BeTkt9Q6wi4LQWaeRQdSvEEUC_cDGO4,2907
|
|
19
|
+
h2o_wave-1.0.1.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
|
|
20
|
+
h2o_wave-1.0.1.dist-info/entry_points.txt,sha256=kFeXNqSZlW1_H7YcRdSOhz5V00F4vhDQ0NuDuvRwLGw,43
|
|
21
|
+
h2o_wave-1.0.1.dist-info/licenses/LICENSE,sha256=hpuFayniDwysSKD0tHGELH2KJDVyhUrKS29torRIpqY,53
|
|
22
|
+
h2o_wave-1.0.1.dist-info/RECORD,,
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Getting Started with H2O Wave
|
|
2
|
-
|
|
3
|
-
This project was bootstrapped with `wave init` command.
|
|
4
|
-
|
|
5
|
-
## Running the app
|
|
6
|
-
|
|
7
|
-
Make sure you have activated a Python virtual environment with `h2o-wave` installed.
|
|
8
|
-
|
|
9
|
-
If you haven't created a python env yet, simply run the following command (assuming Python 3.7 is installed properly).
|
|
10
|
-
|
|
11
|
-
For MacOS / Linux:
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
python3 -m venv venv
|
|
15
|
-
source venv/bin/activate
|
|
16
|
-
pip install h2o-wave
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
For Windows:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
python3 -m venv venv
|
|
23
|
-
venv\Scripts\activate
|
|
24
|
-
pip install h2o-wave
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Once the virtual environment is setup and active, run:
|
|
28
|
-
|
|
29
|
-
```sh
|
|
30
|
-
wave run app.py
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Which will start a Wave app at <http://localhost:10101>.
|
|
34
|
-
|
|
35
|
-
## Interactive examples
|
|
36
|
-
|
|
37
|
-
If you prefer learning by doing, you can run `wave fetch` command that will download all the existing small Python examples that show Wave in action. The best part is that all these examples are interactive, meaning you can edit their code directly within the browser and observe the changes.
|
|
38
|
-
|
|
39
|
-
## Learn More
|
|
40
|
-
|
|
41
|
-
To learn more about H2O Wave, check out the [docs](https://wave.h2o.ai/).
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
from h2o_wave import main, app, Q, ui, on, handle_on
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
@app('/')
|
|
5
|
-
async def serve(q: Q):
|
|
6
|
-
# First time a browser comes to the app
|
|
7
|
-
if not q.client.initialized:
|
|
8
|
-
await init(q)
|
|
9
|
-
q.client.initialized = True
|
|
10
|
-
|
|
11
|
-
# Other browser interactions
|
|
12
|
-
await handle_on(q)
|
|
13
|
-
await q.page.save()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
async def init(q: Q) -> None:
|
|
17
|
-
q.client.cards = set()
|
|
18
|
-
q.client.dark_mode = False
|
|
19
|
-
|
|
20
|
-
q.page['meta'] = ui.meta_card(
|
|
21
|
-
box='',
|
|
22
|
-
title='My Wave App',
|
|
23
|
-
theme='light',
|
|
24
|
-
layouts=[
|
|
25
|
-
ui.layout(
|
|
26
|
-
breakpoint='xs',
|
|
27
|
-
min_height='100vh',
|
|
28
|
-
max_width='1200px',
|
|
29
|
-
zones=[
|
|
30
|
-
ui.zone('header'),
|
|
31
|
-
ui.zone('content', size='1', zones=[
|
|
32
|
-
ui.zone('horizontal', direction=ui.ZoneDirection.ROW),
|
|
33
|
-
ui.zone('vertical', size='1', ),
|
|
34
|
-
ui.zone('grid', direction=ui.ZoneDirection.ROW, wrap='stretch', justify='center')
|
|
35
|
-
]),
|
|
36
|
-
ui.zone(name='footer'),
|
|
37
|
-
]
|
|
38
|
-
)
|
|
39
|
-
]
|
|
40
|
-
)
|
|
41
|
-
q.page['header'] = ui.header_card(
|
|
42
|
-
box='header',
|
|
43
|
-
title='My Wave App',
|
|
44
|
-
subtitle="Example to get us started",
|
|
45
|
-
image='https://wave.h2o.ai/img/h2o-logo.svg',
|
|
46
|
-
items=[ui.menu(icon='', items=[ui.command(name='change_theme', icon='ClearNight', label='Dark Mode')])]
|
|
47
|
-
)
|
|
48
|
-
q.page['footer'] = ui.footer_card(
|
|
49
|
-
box='footer',
|
|
50
|
-
caption='Made with 💛 using [H2O Wave](https://wave.h2o.ai).'
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
await home(q)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
@on()
|
|
57
|
-
async def home(q: Q):
|
|
58
|
-
clear_cards(q)
|
|
59
|
-
add_card(q, 'form', ui.form_card(box='vertical', items=[ui.text('This is my app!')]))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@on()
|
|
63
|
-
async def change_theme(q: Q):
|
|
64
|
-
"""Change the app from light to dark mode"""
|
|
65
|
-
if q.client.dark_mode:
|
|
66
|
-
q.page["header"].items = [ui.menu([ui.command(name='change_theme', icon='ClearNight', label='Dark mode')])]
|
|
67
|
-
q.page["meta"].theme = "light"
|
|
68
|
-
q.client.dark_mode = False
|
|
69
|
-
else:
|
|
70
|
-
q.page["header"].items = [ui.menu([ui.command(name='change_theme', icon='Sunny', label='Light mode')])]
|
|
71
|
-
q.page["meta"].theme = "h2o-dark"
|
|
72
|
-
q.client.dark_mode = True
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# Use for cards that should be deleted on calling `clear_cards`. Useful for routing and page updates.
|
|
76
|
-
def add_card(q, name, card) -> None:
|
|
77
|
-
q.client.cards.add(name)
|
|
78
|
-
q.page[name] = card
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def clear_cards(q, ignore=[]) -> None:
|
|
82
|
-
for name in q.client.cards.copy():
|
|
83
|
-
if name not in ignore:
|
|
84
|
-
del q.page[name]
|
|
85
|
-
q.client.cards.remove(name)
|