Developer guide
Dev environment

Jupyter notebook

The Codelab supports Jupyter notebook files ! Here is the VsCode documentation for Jupyter notebook and how to use them : https://code.visualstudio.com/docs/datascience/jupyter-notebooks
The python extension must be installed to work with Jupyter notebook

Jupyter notebook in Codelab

Here are few tips to use the Jupyter notebook in Codelab.


We recommend using the Jupyter notebook only for testing and developing (like live tasks) purpose. It is not recommended to analyse real data as you will lose the potentiel of the Constellab platform.
You can create your notebook inside the notebooks folder (you will find an exemple here).


You can upload the data you want to test in the data folder (with drag and drop in vscode). If you manage big data, the Jupyter notebook might not be best option to analyse them. It is recommended to test your code with small data and use big data in the lab.
In VsCode you can get the path of a file with right click > 'Copy path'. This can be useful to import file from the data folder.

Load gws environment

If you want to use the gws environment (brick and packages) you will need to use the env.py script. This script will load the complete environment (bricks, tasks, resources...) and you will be able to use them. Here is how to activate and use the gws environment.

import env     
cwd = env.activate()    #activate GWS environment -> cwd will contain the current working dir as abolute path

# The import of any brick after the env.activate
from gws_core import Table, File, TableImporter

# create a File resource
file = File('/lab/user/data/iris.csv')

# Import the File to Table
table: Table = TableImporter.call(file, {"header": 0})

# transpose the table
result = table.transpose()

# print result Dataframe

Any import of a brick (like gws_core here) need to be placed after the activation of the environment. Otherwise, the import will not work.
This code import a Table from a csv file (placed in the data folder). The use the transpose method of the table to transpose it. And print the Dataframe.
You can also run a Jupyer notebook without the gws environment.

Use R in Jupyter notebook

This is possible to use R in Jupyter notebook, please check the following link : https://constellab.community/tech-doc/doc/developer-guide/dev-environment-v2/r-environment