Skip to main content
Version: 1.39

Add environment variables

Deeploy supports adding environment variables or startup argument to the containers that you use in the Deployment. Deeploy supports both default model and explainer images and custom images. A list of supported environment variables and startup arguments is available at the bottom of this article.

info

Take into account that environment variables and arguments only change when updating a Deployment.

Environment variables

Environment variables are a set of dynamically named values that can affect the way that running processes will behave in a program. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files (e.g. TEMP=/example/dir).

Adding an environment variable when creating a deployment in Deeploy

Choose one of the following CreateDeployment options to add your environment variables to the model, explainer or transformer:

  • model_env: dict
  • explainer_env: dict
  • transformer_env: dict

Example:

from deeploy import Client, CreateDeployment
from deeploy.enums import ModelType

# intitialise the client
client = Client(
# if using the Deeploy cloud version 'host' is 'app.deeploy.ml'
host="app.deeploy.ml",
workspace_id="xxxx-example",
access_key="dexamplekey",
secret_key="examplesecretkey",
)

# define the create options
create_options: CreateDeployment = {
"name": "Python Client",
"description": "Python Client Description",
"model_type": ModelType.SKLEARN,
"model_serverless": True,
"model_env": {"PREDICT_PROBA": "true"}
}

# create deployment
# defining the local_repository_path here uses the local git cofiguration to create the deployment.
deployment = client.create_deployment(options=create_options, local_repository_path=".")

Startup arguments

Startup arguments, also known as command-line arguments, are inputs to a program that are specified when the program starts. These arguments can affect the behavior of the program. For example, a program might accept a --verbose true startup argument that causes it to output more status data as it runs.

Adding a startup argument when updating a Deployment in Deeploy

Choose one of the following UpdateDeployment options to add your arguments to the model, explainer or transformer:

  • model_args: dict
  • explainer_args: dict
  • transformer_args: dict

Example:

from deeploy import Client, UpdateDeployment
from deeploy.enums import ModelType

# intitialise the client
client = Client(
# if using the Deeploy cloud version 'host' is 'app.deeploy.ml'
host="app.deeploy.ml",
workspace_id="xxxx-example",
access_key="dexamplekey",
secret_key="examplesecretkey",
)

# define the update options
update_options: UpdateDeployment = {
"name": "Python Client",
"description": "Python Client Description",
"model_args": {"verbose": "true"}
}

# defining the local_repository_path here uses the local git cofiguration to create the deployment.
deployment = client.update_deployment(options=update_options, deployment_id="xxx", local_repository_path=".")

Supported variables default images

The list below is expect to increase in the future.

Default imagevariablepossible values
kserve/sklearnserver:v0.11.0PREDICT_PROBA'true', 'false'