Programmatically set default code environment for a project

michellepace
Level 1
Programmatically set default code environment for a project

Hello,

I am programmatically creating projects and would also like to programmatically set the default code environment for each project. The first screenshot below shows how to do this per project manually. I have looked in the API for the project object but cannot find any way to do this. I am hoping the documentation is perhaps just out of date. Does anyone perhaps know how to do this? 

 
Thanks in advance, Michelle

Operating system used: Windows


Operating system used: Windows

0 Kudos
1 Reply
FlorentD
Developer Advocate

Hi Michelle,

You can create code env by using

import dataiku


client = dataiku.api_client()

client.create_code_env(...)

 

The documentation for creating a code env is here.

Then you can set the default code env by using:

project = dataiku.get_projct("PROJECT_KEY)

settings = project.get_settings().get_raw()

# modify the code env section

settings.save()

 

Hope this help and answer your question

Best

0 Kudos