Skip to content

hopsworks.core.environment_api #

[source] EnvironmentApi #

[source] create_environment #

create_environment(
    name: str,
    description: str | None = None,
    base_environment_name: str
    | None = "python-feature-pipeline",
    await_creation: bool | None = True,
) -> environment.Environment

Create Python environment for the project.

import hopsworks

project = hopsworks.login()

env_api = project.get_environment_api()

new_env = env_api.create_environment("my_custom_environment", base_environment_name="python-feature-pipeline")
PARAMETER DESCRIPTION
name

Name of the environment.

TYPE: str

base_environment_name

The name of the environment to clone from.

TYPE: str | None DEFAULT: 'python-feature-pipeline'

await_creation

Whether the method returns only when the creation is finished.

TYPE: bool | None DEFAULT: True

RETURNS DESCRIPTION
environment.Environment

The Environment object.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.

[source] get_environment #

get_environment(
    name: str,
) -> environment.Environment | None

Get handle for a Python environment in the project.

import hopsworks

project = hopsworks.login()

env_api = project.get_environment_api()

env = env_api.get_environment("my_custom_environment")
PARAMETER DESCRIPTION
name

Name of the environment.

TYPE: str

RETURNS DESCRIPTION
environment.Environment | None

The Environment object or None if it does not exist.

RAISES DESCRIPTION
hopsworks.client.exceptions.RestAPIError

If the backend encounters an error when handling the request.