This article is for users who would like to build H2O Wave apps and publish them in the App Store within the H2O AI Cloud (HAIC). We will walk through how to set up your local machine for HAIC Wave App development.
H2O Wave is a framework for building frontends using only python or R. In this article we will specifically focus on how to set up your Python development environment. To learn more about how to get started writing Wave apps, once your environment is set up, check out this blog .
./venv/bin/pip install h2o-wave==0.20.0
or conda install -c h2oai h2o-wave==0.20.0
venv
using python3 -m venv venv
or, if you manage python using conda you can use conda create --name venv
.app.py
and add the below code.from h2o_wave import main, app, Q, ui
@app('/demo')
async def serve(q: Q):
q.page["my_form_card"] = ui.form_card(
box='1 1 -1 -1',
items=[
ui.text("My first app!")
]
)
await q.page.save()
http://<YOUR_DOMAIN>:10101/demo
./venv/bin/wave run app.py
We have now set up our local environment for building and running H2O Wave apps. Next, we will configure our connection to the H2O AI Cloud where we will publish our applications.
The H2O CLI allows you to interact with the H2O AI Cloud from your terminal. This is easiest way to upload and launch Apps, look at available App Secrets, and allow specific groups of users to access your Apps, among other things. To learn more about what is possible with this tool, check out the documentation .
$PATH
or add the file’s location to your $PATH
. This ensures that you can interact with the platform from anywhere on your computerchmod +x h2o
h2o config setup
. You will be asked for information which can be found in the CLI & API Access
page when you click your name on the platform
h2o -h
to get help on how to use the client. This will tell you what features are available and also what parameters to use for a specific command, for example, try h2o app list -h
.Now that we can build and run Wave apps locally and we can use the CLI to connect with the H2O AI Cloud, we are ready to publish our app. We need 3 files to publish our app into the App Store.
app.py
that has our app coderequirements.txt
and add the line h2o-wave==0.20.0
to the file. This tells the App Store which packages and versions to install when running the app.requirements.txt
to ensure that your app does not break or get unexpected behavior when a new version of a library is available on PyPi.h2o-wave
h2o-wave==0.20.0
app.toml
and add the below text to the file. This will tell the App Store what metadata to show about the app to users in the App Store and also any special rules about running the app. For example, should there be GPUs? Does the end-user need to log in to the app to access the content? etc. You can view all options for this file here.Module
is the file name of our source code, note that we do not include the .py
file extension, just the name of the file. If you have all your source code in a folder called src
and your main app file called app.py
, the value for Module
would be src.app
app.toml
[App]
Name = "ai.h2o.wave.my-first-app"
Version = "0.0.1"
Title = "Hello, World!"
Description = "Show a card to the user explaining this is my first app."
[Runtime]
Module = "app"
h2o bundle deploy
h2o bundle deploy
mtanco@MTanco-MBP15 my_demo_app % h2o bundle deploy
ID 25745b3e-134b-4527-90e2-2a08a015eed4
Title Hello, World!
Version 0.0.1-20220311073405
Created At 2022-03-11 15:34:07.155791 +0000 UTC
Updated At 2022-03-11 15:34:07.155791 +0000 UTC
Owner michelle.tanco@h2o.ai
Visibility PRIVATE
Tags
Description Show a card to the user explaining this is my first app.
Long Description
ID 5d5be5be-228a-4cfa-80f7-a6cb0b46456e
URL https://5d5be5be-228a-4cfa-80f7-a6cb0b46456e.cloud-internal.h2o.ai
mtanco@MTanco-MBP15 my_demo_app %
/demo
to the provided URL and visit it to see your running Apph2o bundle import -v ALL_USERS
. Visit your App Store to see your app!This article walked us through
h2o
CLI to connect to an instance of the H2O AI CloudIn a future article, we will discuss additional features for deployed apps to improve the user experience of running and using your app.
Sign up for a free demo and get hands-on experience with H2O AI Cloud today.