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,
    entrypoint_script: str | None = None,
) -> 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

entrypoint_script

Relative entrypoint script for Streamlit git apps.

TYPE: str | None DEFAULT: None

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.