Cloning a Library from a Remote Git Repository¶
An important end goal of writing code is to be able to reuse it, whether within a Dataiku project, across projects within a Dataiku instance, or for projects external to Dataiku. To this end, you can define code Libraries within Dataiku DSS that contain reusable code, and you can connect these libraries to remote git repositories.
- Access to a Dataiku DSS instance that has been set up to work with remote Git repositories.
Connect to a Remote Git Repository¶
Within any Dataiku project, navigate to Code > Libraries to the Library Editor.
- Click Git > Import from Git.
https://github.com/dataiku/dss-plugin-sample-correlationsas the Repository.
- Leave master as the branch to checkout
python-libas the Path in repository. This repository contains a plugin, and for this project library, we only want to retrieve the library that is part of the plugin. To retrieve the entire plugin, we can clone it from the remote Git repo to the Plugin editor.
python/compute-corras the Target path. This determines where in the project library the remote code will be stored.
- Click Save and Retrieve.
You should now see the contents of the remote library in the Library Editor.
The library functions can now be used in code in the Dataiku project by including an import statement such as:
from compute_corr import *
Pulling Updates from the Remote Repository¶
When code on the remote repository is updated, you can pull those updates to your local project library. From within the Library Editor:
- Click Git > Manage references.
- Click Update on each individual remote Git repository that you want to pull updates from
- Alternatively, click Update All References to pull updates from every remote Git repo.
Changes made to your local Dataiku project library cannot be pushed back to the remote Git repository.