Skip to content

hopsworks.project #

Project #

Class representing a Hopsworks project.

Use hopsworks.login to get the current project after logging in.

Use hopsworks.create_project to create a new project and get the project object.

created property #

Timestamp when the project was created.

description property #

Description of the project.

home_path property #

home_path: str

Path to the current user's home directory within this project.

The home directory is located at /Projects/<project_name>/Users/<username> and is created automatically when a user joins a project.

id property #

Id of the project.

name property #

Name of the project.

owner property #

Owner of the project.

project_namespace property #

Kubernetes namespace used by project.

add_member #

add_member(
    email: str, role: str
) -> project_member.ProjectMember

Add a user to the project.

Example
import hopsworks

project = hopsworks.login()

project.add_member("alice@example.com", "Data scientist")
PARAMETER DESCRIPTION
email

Email address of the user to add.

TYPE: str

role

The project role to grant, one of Data owner, Data scientist, Observer, Feature store restricted.

TYPE: str

RETURNS DESCRIPTION
project_member.ProjectMember

The newly added ProjectMember.

RAISES DESCRIPTION
ValueError

If role is not a settable project role.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request, for example if the caller is not a project owner.

create_featurestore_alert #

create_featurestore_alert(
    receiver: str,
    status: Literal[
        "feature_validation_success",
        "feature_validation_warning",
        "feature_validation_failure",
        "monitoring_shift_undetected",
        "monitoring_shift_detected",
        "monitoring_empty_detection_window",
        "feature_monitor_shift_undetected",
        "feature_monitor_shift_detected",
    ],
    severity: Literal["critical", "warning", "info"],
) -> alert.ProjectAlert

Create an alert for feature validation and monitoring in this project.

Example for creating a featurestore alert
import hopsworks
project = hopsworks.login()
project.create_featurestore_alert("my_receiver", "feature_validation_success", "info")
PARAMETER DESCRIPTION
receiver

The receiver of the alert.

TYPE: str

status

The status of the alert. The names feature_monitor_shift_undetected and feature_monitor_shift_detected are deprecated since ~=3.8.1 and will be removed in a future release.

TYPE: Literal['feature_validation_success', 'feature_validation_warning', 'feature_validation_failure', 'monitoring_shift_undetected', 'monitoring_shift_detected', 'monitoring_empty_detection_window', 'feature_monitor_shift_undetected', 'feature_monitor_shift_detected']

severity

The severity of the alert.

TYPE: Literal['critical', 'warning', 'info']

RETURNS DESCRIPTION
alert.ProjectAlert

The created ProjectAlert object.

RAISES DESCRIPTION
ValueError

If status or severity is invalid, also if receiver is None.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

create_job_alert #

create_job_alert(
    receiver: str,
    status: Literal[
        "job_finished",
        "job_failed",
        "job_killed",
        "job_long_running",
    ],
    severity: Literal["critical", "warning", "info"],
) -> alert.ProjectAlert

Create an alert for jobs in this project.

Example for creating a job alert
import hopsworks
project = hopsworks.login()
project.create_job_alert("my_receiver", "long_running", "info")
PARAMETER DESCRIPTION
receiver

The receiver of the alert.

TYPE: str

status

The status of the alert.

TYPE: Literal['job_finished', 'job_failed', 'job_killed', 'job_long_running']

severity

The severity of the alert.

TYPE: Literal['critical', 'warning', 'info']

RETURNS DESCRIPTION
alert.ProjectAlert

The created ProjectAlert object.

RAISES DESCRIPTION
ValueError

If status or severity is invalid, also if receiver is None.

hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_alert #

get_alert(alert_id: int) -> alert.ProjectAlert | None

Get an alert for the project by ID.

PARAMETER DESCRIPTION
alert_id

The ID of the alert.

TYPE: int

RETURNS DESCRIPTION
alert.ProjectAlert | None

The ProjectAlert object.

get_alerts #

get_alerts() -> list[alert.ProjectAlert]

Get all alerts for the project.

RETURNS DESCRIPTION
list[alert.ProjectAlert]

List of ProjectAlert objects.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_alerts_api #

get_alerts_api() -> alerts_api.AlertsApi

Get the alerts api for the project.

RETURNS DESCRIPTION
alerts_api.AlertsApi

The Alerts Api handle.

get_app_api #

get_app_api() -> app_api.AppApi

Get the app API for the project.

Use this to manage Streamlit apps.

Example
apps = project.get_app_api()
for app in apps.get_apps():
    print(f"{app.name}: {app.state}")
RETURNS DESCRIPTION
app_api.AppApi

The App Api handle.

get_dataset_api #

get_dataset_api() -> dataset_api.DatasetApi

Get the dataset api for the project.

RETURNS DESCRIPTION
dataset_api.DatasetApi

The Datasets Api handle.

get_environment_api #

get_environment_api() -> environment_api.EnvironmentApi

Get the Python environment API for the project.

RETURNS DESCRIPTION
environment_api.EnvironmentApi

The Python Environment Api handle.

get_feature_store #

get_feature_store(name: str | None = None) -> FeatureStore

Connect to Project's Feature Store.

Defaulting to the project name of default feature store. To get a shared feature store, the project name of the feature store is required.

Example for getting the Feature Store API of a project
import hopsworks

project = hopsworks.login()

fs = project.get_feature_store()
PARAMETER DESCRIPTION
name

Project name of the feature store.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
FeatureStore

The Feature Store API.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_git_api #

get_git_api() -> git_api.GitApi

Get the git repository api for the project.

RETURNS DESCRIPTION
git_api.GitApi

The Git Api handle.

get_job_api #

get_job_api() -> job_api.JobApi

Get the job API for the project.

RETURNS DESCRIPTION
job_api.JobApi

The Job Api handle.

get_kafka_api #

get_kafka_api() -> kafka_api.KafkaApi

Get the kafka api for the project.

RETURNS DESCRIPTION
kafka_api.KafkaApi

The Kafka Api handle.

get_members #

get_members() -> list[project_member.ProjectMember]

Get all members of the project.

Example
import hopsworks

project = hopsworks.login()

for member in project.get_members():
    print(member.email, member.role)
RETURNS DESCRIPTION
list[project_member.ProjectMember]

List of ProjectMember objects, one per user who has access to the project.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_members_api #

get_members_api() -> project_members_api.ProjectMembersApi

Get the project members API for the project.

Use this to manage who has access to the project and at which role.

RETURNS DESCRIPTION
project_members_api.ProjectMembersApi

The Project Members Api handle.

get_model_registry #

get_model_registry() -> ModelRegistry

Connect to Project's Model Registry API.

Example for getting the Model Registry API of a project
import hopsworks

project = hopsworks.login()

mr = project.get_model_registry()
RETURNS DESCRIPTION
ModelRegistry

The Model Registry API.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_model_serving #

get_model_serving() -> ModelServing

Connect to Project's Model Serving API.

Example for getting the Model Serving API of a project
import hopsworks

project = hopsworks.login()

ms = project.get_model_serving()
RETURNS DESCRIPTION
ModelServing

The Model Serving API.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

get_opensearch_api #

get_opensearch_api() -> opensearch_api.OpenSearchApi

Get the opensearch api for the project.

RETURNS DESCRIPTION
opensearch_api.OpenSearchApi

The OpenSearch Api handle.

get_search_api #

get_search_api() -> search_api.SearchApi

Get the search api for the project.

RETURNS DESCRIPTION
search_api.SearchApi

The Search Api handle.

get_superset_api #

get_superset_api() -> superset_api.SupersetApi

Get the Superset API for the project.

RETURNS DESCRIPTION
superset_api.SupersetApi

The Superset API handle.

get_trino_api #

get_trino_api() -> trino_api.TrinoApi

Get the Trino API for the project.

RETURNS DESCRIPTION
trino_api.TrinoApi

The Trino API handle.

get_trino_catalog_api #

get_trino_catalog_api() -> (
    trino_catalog_api.TrinoCatalogApi
)

Get the Trino catalog API for the project.

Distinct from get_trino_api, which connects to the query engine and runs queries. This one manages which sources the engine can query, and the restart that applies a change.

Example
import hopsworks

project = hopsworks.login()
catalog_api = project.get_trino_catalog_api()

for catalog in catalog_api.get_catalogs():
    print(catalog["name"], catalog["status"])
RETURNS DESCRIPTION
trino_catalog_api.TrinoCatalogApi

The Trino catalog API handle.

get_url #

get_url()

Get url to the project in Hopsworks.

remove_member #

remove_member(
    email: str, delete_home_dir: bool = False
) -> None

Remove a user from the project.

Deletes the member's project files when delete_home_dir=True

All files under this member's home directory in the project are permanently deleted and cannot be recovered.

Example
import hopsworks

project = hopsworks.login()

project.remove_member("alice@example.com")
PARAMETER DESCRIPTION
email

Email address of the member to remove.

TYPE: str

delete_home_dir

Whether to also delete the member's home directory in the project.

TYPE: bool DEFAULT: False

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request, for example if a data scientist tries to remove someone other than themselves.