Skip to content

Deployment package structure

Your deployment code needs to be packaged in a fixed structure for the UbiOps platform to run it.

The packaged deployment is a zip file containing a number of required files and directories. This page specifies in what structure UbiOps expects your deployment file.

Deploying to UbiOps

Templates available on GitHub

Template structures are available for the supported programming languages on our Github. You can download an example deployment package .zip here: Download example deployment package.

Deployment package structure

The structure of the package is similar for every language:

  • A deployment file that contains code which instructs UbiOps how to initialize and use your deployment for inference.
  • (optional) Files containing package and library requirements that are installed and managed by UbiOps, for example requirements.txt for Python.
  • (optional) Files containing deployment artifacts and attributes. For instance a model parameter file or pickle file.
  • (optional) A directory libraries where you can include dependencies that your deployment uses. This directory is added to the system $PATH variable, such that its contents can be easily imported.
  • (optional) A ubiops.yaml for installing OS level packages your deployment needs. For more information see installing OS level packages.

Each deployment package should be uploaded as a ZIP archive. This ZIP can have any name. The ZIP must contain a directory, which can have any name, in the root of the ZIP. If your ZIP contains multiple directories, it will look for a directory called deployment_package. The directory then contains all deployment files. We will refer to this directory as the deployment package directory.

Deployment input and output types

When creating a new deployment, a user defines what data the deployment expects when making a request, and what data it returns. UbiOps supports two types of data input and output:

  • Structured: Structured data consists of a dictionary with one or more key value pairs with an associated data type (integer, string, double, boolean, array of integers, array of doubles, array of strings or a file (see Blob (file) handling for more details)).
  • Plain: Any string without structure that is JSON serializable.

More details on the data types can be found on the In- and output section. In that section there are also examples on how to convert the well-known Python data structures NumPy Arrays and Pandas DataFrames to data-types that UbiOps can work with. You can use different data types for input and output, for example a deployment with structured input and plain output, or vice-versa.


The request method has an attribute called data. This attribute will contain the data that is used as an input into the instance of the deployment.

  • When using a structured input, the data attribute will contain a dictionary.
    • When sending a file (a structured field of type 'blob'), the value will contain the absolute path where the deployment can access the file. For example, if you create a request with the file 'input.csv' as one of the input fields, the value will be a path: .../input.csv.
  • For a plain input the data will contain the plain text string as input.


The request method is expected to return output in the format you defined when setting up the deployment. It is required that the output is JSON serializable.

  • When using a structured output, the returned value should be a JSON serializable dictionary (single), or a list of these JSON serializable dictionaries (plural).
    • If a structured field is of type file (blob), the value for this key should contain the absolute path where the output file is stored. UbiOps will then collect this file and process it as an output of your request. You can easily create the absolute path using the 'base_directory' passed in the __init__ method of the deployment file.
  • In case of plain output, the returned parameter should be a string.