Skip to content

Create a Daisi

A Daisi can be created from any Python code which is stored on Github.

So the first step is to make sure that your code is actually pushed to a Github repository.

You need to have an account and to be logged in the Daisi platform to create a new Daisi. Sign up to create an account or sign in.

From Python code to a deployed serveless function in one click

Let's start by creating a simple Print Hello daisi.

The Python code would simply be a regular Python function:

   def hello(name = "World"):

    return "Hello " + str(name)

Turning this code into a deployed serverless function only requires two steps:

  1. Step 1 : Push the code to a Github repository.
  2. Step 2 : Register the Github repository in the Daisi platform.

Click on the Create a new daisi button, give the daisi a name (Print Hello for instance) and enter the address to the Github repository.

On the next screen, confirm the branch to use, the folder in the repository and the Python script containing the function. Then click on Create.

The Daisi platform will automatically parse the requirements, create a virtual environment and generate an endpoint for every function in the code. When it says "Ready", your code is now deployed and a worker will be available to run it whenever someone triggers its execution !

Open the card corresponding to the new Print Hello daisi and go to the How to tab. Our code contains simply one function (def hello()), so only one endpoint has been created (hello). In case that multiple functions are present in the main script, there will be one endpoint per function.

Print Hello can be called from various clients, including with a regular HTTP request (see the CURL tab).
At the moment, the Python client pyDaisi is the most developed.

The Python section of the How to tab features a snippet of code to call immediately the Daisi from a remote environment with pydaisi (see Simple executions). In this example, it should look like:

import pydaisi as pyd
print_hello = pyd.Daisi(username/"Print Hello")

Go to Settings and click on the Make public button. Your "Print Hello" Daisi is now visible by every Daisi user, they can open its card and call it with pydaisi. Visibility settings are describe in Sharing Daisies - Teams

Virtual environment creation

A virtual environment will be automatically created for your Daisi to run. The venv will be populated with the required Python packages and dependencies. The Daisi platform will create the virtual environment with Miniconda and then uses pip to install and manage Python packages. If no requirements.txt file is available in the folder of the main script, the Daisi platform will parse the main script and try to identify the required packages.

However, it is strongly recommended to include a requirements.txt file, and to specify the version number of the packages if needed. You can generate a requirements file with

pip freeze > requirements.txt

Endpoints creation

Endpoints will be created for every function of the Python script that you have selected, i.e for every def statement:

# An endpoint will be created automatically for my_func()
def my_func(*args):
    # do and return something

With the following exceptions:

  • There is no function definition : if your code is simply a series of statements, without any function definition, the Daisi platform will not create any endpoint.
  • No endpoints will be created for classes definition
  • No endpoints will be created for classes methods
  • No endpoints will be created for module privates (whith name starting with an _ or __)

Think about how you want to design your endpoints and write functions accordingly so they deliver the most value to your end users.

Endpoints documentation

A documentation is generated automatically for each endpoint created. It is strongly recommended to add docstrings to document the functions which will be the most important endpoints of your Daisi, describing the input arguments and the returned objects. We encourage to follow the format below:

def my_func(name1, name2)
# Here below is the docstring:
A short sentence describing the function purpose

- name1 (type) : description
- name2 (type) : description

- object type : description

Adding a Readme (

The Readme tab of the daisi page will display the content of the from your Github repository. It will try to default to if is not present.

It is a good practice to include a file which explains what your Daisi does, and write a self-contained example that a user could copy to have an immediate overview of how your Daisi works. Include also any useful reference to the code, including source papers, and give appropriate credits. Check the Examples section in the Daisi platform for examples of

Updating the metadata

In the Settings tab, you can add the following information to make your Daisi easily discoverable in the platform:

  • tags: you can type in any relevant tag for your Daisi. Try to reuse existing tags as much as possible to aboid duplicate and make it easily discoverable
  • image : add an inspiring image which will be featured on the Daisi card, so it get noticed
  • description : a short sentence describing your Daisi which will be featured in the Daisi card. It is not supposed to replace the content of the file. Keep detailed descriptions for the Readme tab.