My first Code Studio#

When coding and building solutions in Dataiku, it can be helpful to access your own integrated development environment (IDE), such as JupyterLab or Visual Studio Code (VS Code). Dataiku Code Studios allow you to do just that, and much more! In this tutorial, you will learn how to create a Code Studio template and run it.

Prerequisites#

  • A Dataiku 11+ instance.

  • Administrator privileges for your user profile.

  • A Kubernetes cluster is configured. For details, visit Elastic AI Computation.

  • A base image is built. Typically, this is built using a command such as ./bin/dssadmin build-base-image --type container-exec. For details, visit Build the Base Image.

Creating a Code Studio template#

To use Code Studios, you’ll need to set up a Code Studio template.

Attention

You’ll need Administrator privileges on your instance to create a Code Studio template.

To do this:

  1. In your Dataiku instance, choose Administration from the Applications menu.

  2. Navigate to the Code Studios tab.

  3. Select + Create Code Studio Template.

    Code Studios tab in the Admin menu.

    Code Studios tab in the Admin menu.#

  4. Type a name for your template, such as my-vsc-template, and then select Create.

Configuring general settings#

In the General tab, name and describe your template. You can add an icon. The Build section uses your default container, which you can change.

Code Studio configuration.

Code Studio configuration.#

Configuring definition settings#

The Definition settings define the services that your template provides. To enrich the template definition, you add blocks. By default, a Code Studio template comes with two default blocks (File Synchronization and Kubernetes Parameters):

  • File Synchronization: This block enables synchronisation between your Code Studio and Dataiku. There is no automatic save, and you will need to synchronise your files to save/edit your files within Code Studio.

    A CodeStudio_README.md file explains what those different directories are. In addition, you can find more information in the Code Studio reference documentation. Let’s summarise the use cases for every directory available in a Code Studio.

    Directories

    Scope

    Example

    Default mounting location

    Agent Tools

    Project

    Inline Python Tool files

    agent-tools

    Code Agent

    Project

    Code Agent files

    code-agents

    Code Studio versioned files

    Code Studio

    Streamlit source code files

    code_studio-versioned

    Code Studio resources

    Code Studio

    Code Studio - specific images

    code_studio-resources

    Notebooks

    Project

    Project Notebooks

    notebooks

    Project libraries

    Project

    Project Libraries

    project-lib-versioned

    Project resources

    Project

    Project-specific images

    project-lib-resources

    Project recipes

    Project

    Project recipes

    recipes

    User config

    User

    IDE config files

    user-versioned

    User resources

    User

    Plugins IDE

    user-resources

    Webapps

    Project

    Native webapps files

    webapps

    Important

    The resources folders (code_studio-resources, project-lib-resources, user-resources) are not versioned in the project.

    Note

    These directories are available by default; however, a Code Studio administrator can configure them from a Code Studio template using the File synchronization block.

    File Synchronization block.

    File Synchronization block.#

  • Kubernetes Parameters: This special block controls advanced settings. For more information, please refer to the documentation.

To edit files in Code Studio, let’s add a VS Code block so that we can use a VS Code editor in our browser.

  1. Navigate to the Definition tab.

  2. Select Add a Block.

  3. In Select a block type, click Visual Studio Code.

  4. Leave the other settings as default and select Save.

Note

The VS Code block contains a basic Python code environment and Dataiku APIs by default. To add a specific code environment, select Add Block. In Select a block type, select Add Code Environment.

Code Studio template definition.

Code Studio template definition.#

Building the template#

Let’s build and publish the Docker image so that our template becomes available. To do this:

  1. Select Build.

  2. Wait while Dataiku begins building the Docker image.

  3. Once the build is complete, you can select Build History to view the build details.

We are now ready to use VS Code in our project!

Launching your first Code Studio#

Back in our project, we’ll launch Code Studios and select our new VS Code template.

  1. From the Code menu, select Code Studios.

  2. Select Create Your First Code Studio.

  3. In New Code Studio, select the VS Code template you just created.

  4. Name the Code Studio VS Code and select Create.

    Launching a new Code Studio in a project.

    Launching a new Code Studio in a project.#

    Now that your Code Studio is created, let’s start it and get a first look!

  5. Select Start Code Studio.

    Wait while Dataiku starts the Code Studio and launches it in a browser window.

    Note

    If it’s the first time, VS Code may ask you to trust the authors.

    Click Yes, I trust the authors to move forward.

Wrapping up#

In this tutorial, you’ve learned how to set up and launch a Code Studio in Dataiku, giving you access to powerful development environments like VS Code directly within your project. By following these steps, you can efficiently create and customise templates, configure your environment, and start coding right away. Code Studios streamlines development workflows, making it easier to build, debug, and maintain your solutions within Dataiku.

If you want to deep dive into using VSCode within Code Studio, you should read this tutorial.