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.0or
conda install -c h2oai h2o-wave==0.20.0
python3 -m venv venvor, if you manage python using conda you can use
conda create --name venv.
app.pyand add the below code.
from h2o_wave import main, app, Q, ui
async def serve(q: Q):
q.page["my_form_card"] = ui.form_card(
box='1 1 -1 -1',
ui.text("My first app!")
./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 .
$PATHor add the file’s location to your
$PATH. This ensures that you can interact with the platform from anywhere on your computer
chmod +x h2o
h2o config setup. You will be asked for information which can be found in the
CLI & API Accesspage when you click your name on the platform
h2o -hto 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.pythat has our app code
requirements.txtand add the line
h2o-wave==0.20.0to the file. This tells the App Store which packages and versions to install when running the app.
requirements.txtto ensure that your app does not break or get unexpected behavior when a new version of a library is available on PyPi.
app.tomland 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.
Moduleis the file name of our source code, note that we do not include the
.pyfile extension, just the name of the file. If you have all your source code in a folder called
srcand your main app file called
app.py, the value for
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."
Module = "app"
h2o bundle deploy
h2o bundle deploy
mtanco@MTanco-MBP15 my_demo_app % h2o bundle deploy
Title Hello, World!
Created At 2022-03-11 15:34:07.155791 +0000 UTC
Updated At 2022-03-11 15:34:07.155791 +0000 UTC
Description Show a card to the user explaining this is my first app.
mtanco@MTanco-MBP15 my_demo_app %
/demoto the provided URL and visit it to see your running App
h2o bundle import -v ALL_USERS. Visit your App Store to see your app!
This article walked us through
h2oCLI to connect to an instance of the H2O AI Cloud
In a future article, we will discuss additional features for deployed apps to improve the user experience of running and using your app.