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 DSS project, across projects within a DSS instance, or for projects external to DSS.
To this end, you can define code Libraries within DSS that contain reusable code, and you can connect these libraries to remote git repositories.
- Access to a DSS instance that has been set up to work with remote Git repositories
Connect to a Remote Git Repository¶
Within any DSS 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 DSS 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 from which you want to pull updates.
- Alternatively, click Update All References to pull updates from every remote Git repo.
Changes made to your local Dataiku DSS project library cannot be pushed back to the remote Git repository.