Skip to content

hopsworks.core.app_api #

AppApi #

create_app #

create_app(
    name: str,
    app_path: str | None = None,
    environment: str = "python-app-pipeline",
    memory: int = 2048,
    cores: float = 1.0,
    env_vars: dict[str, str] | None = None,
    app_kind: str = "STREAMLIT",
    entrypoint_command: str | None = None,
    app_port: int | None = None,
    description: str | None = None,
    git_url: str | None = None,
    git_provider: str | None = None,
    git_branch: str | None = None,
    git_auto_redeploy: bool = False,
    entrypoint_script: str | None = None,
    app_base_path: str | None = None,
    readiness_probe_path: str | None = None,
    db_access: bool = True,
) -> app.App

Create a new Python app.

Example
import hopsworks

project = hopsworks.login()
apps = project.get_app_api()

app = apps.create_app(
    "my_dashboard",
    app_path="Resources/app.py",
)

app.run()
print(app.app_url)
PARAMETER DESCRIPTION
name

Name of the app.

TYPE: str

app_path

Path to the app file in HopsFS.

TYPE: str | None DEFAULT: None

environment

Python environment name (default: "python-app-pipeline").

TYPE: str DEFAULT: 'python-app-pipeline'

memory

Memory in MB (default: 2048).

TYPE: int DEFAULT: 2048

cores

CPU cores (default: 1.0).

TYPE: float DEFAULT: 1.0

env_vars

Per-runtime env vars applied when the app is started. These override account-level env vars for this app's executions.

TYPE: dict[str, str] | None DEFAULT: None

app_kind

App kind to create. Defaults to STREAMLIT.

TYPE: str DEFAULT: 'STREAMLIT'

entrypoint_command

Startup command for non-Streamlit apps.

TYPE: str | None DEFAULT: None

app_port

Port exposed by non-Streamlit apps.

TYPE: int | None DEFAULT: None

description

Optional app description.

TYPE: str | None DEFAULT: None

git_url

Optional Git repository URL. When set, the app is cloned on every start.

TYPE: str | None DEFAULT: None

git_provider

Git provider for git-backed apps (GitHub, GitLab or BitBucket).

TYPE: str | None DEFAULT: None

git_branch

Optional branch to clone for git-backed apps.

TYPE: str | None DEFAULT: None

git_auto_redeploy

Roll the app to the branch HEAD whenever a new commit is pushed. Only valid for git-backed apps. The running app keeps serving until the new version is ready.

TYPE: bool DEFAULT: False

entrypoint_script

Relative entrypoint script for Streamlit git apps.

TYPE: str | None DEFAULT: None

app_base_path

Public mount path for the app, for example / or /myapp.

TYPE: str | None DEFAULT: None

readiness_probe_path

Optional readiness probe path to use instead of the platform default.

TYPE: str | None DEFAULT: None

db_access

Give the app access to the project's online feature store database. Defaults to True: starting the app creates the database if the project does not have one yet and injects the MYSQL_USER, MYSQL_PASSWORD_SECRET_NAME, MYSQL_DB, MYSQL_HOST and MYSQL_PORT environment variables into the app container, the same way agent deployments get them. Set to False for apps that do not need the database. Independently of this flag, when Trino is enabled on the cluster every app gets TRINO_HOST, TRINO_PORT, TRINO_USER, TRINO_PASSWORD_SECRET_NAME and TRINO_SCHEMA to read the offline feature group tables with SQL (the catalog is the feature group's format, delta or hudi, chosen by the app).

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
app.App

The created App object.

get_app #

get_app(name: str) -> app.App | None

Get an app by name.

PARAMETER DESCRIPTION
name

Name of the app.

TYPE: str

RETURNS DESCRIPTION
app.App | None

App object, or None if no app with that name exists, so a

app.App | None

reuse-if-exists guard does not have to catch a 404.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error other than a 404.

get_apps #

get_apps() -> list[app.App]

Get all apps in the project.

RETURNS DESCRIPTION
list[app.App]

List of App objects.