Join us on Wednesday, June 3rd for a deep dive into Customer Predictive Analytics Learn more

How to import code from GitHub, GitLab, or Bitbucket

How to import code from GitHub, GitLab, or Bitbucket

When working with code, it's widespread to use libraries for isolating any reusable pieces of code and version them separately from the projects in which they're used. If they are available in a Git repository, DSS provides a way to import Python and R libraries so that they can be used in any code capability of DSS, including recipes, notebooks, or web apps.

Since the import is entirely based on Git, it works with any Git hosting service like Github, Gitlab or Bitbucket. Also, it can be a public or a private repository, as long as DSS has been configured to have access to it.

First, from the project on which you want to import the code, navigate to the Libraries page.
 
Screen Shot 2020-04-22 at 3.50.48 PM.png
 
From here, you can develop new libraries, or you can decide to import an existing one from a remote Git repository. Click on the Git button, and select Import from Git.
 
Screen Shot 2020-04-22 at 3.51.45 PM.png
 
Then, fill in the following fields:
  • "Repository" must contain the URL for cloning the repository.
  • The "Checkout" field can contain:
    • The name of the branch to checkout (If you click on the refresh button next to this field, DSS will fetch the repository and will list the available branches.)
    • A tag
    • A commit hash
  • "Path in repository" allows you to configure a path to a subfolder within the library repository. It can be particularly useful if multiple libraries are stored within the same repository, and if you need to import some of them only, rather than importing the entire repository in your project.
  • "Target path" allows you to configure the local path where the libs will be imported. Leave empty to import them in the lib folder.
  • "Add to python path" allows you to add the local path to the lib into the PYTHONPATH environment variable, allowing you to use the library without additional configuration wherever it has been imported.

Library_import_modal.png


Click on "Save and Retrieve" to proceed to the importation of the external library into the project.
 
Library_imported.png

DSS has created a "Git reference", which allows the imported code to be updated by pulling new updates from the remote repository anytime, either manually, or automatically thanks to our scenario step.

The imported library can now be used from anywhere in the project.

In my example, I just need to write the following  line to use it:
 
from autokeras_dataiku import *

What's next?

 

Labels (5)
Version history
Revision #:
2 of 2
Last update:
‎04-22-2020 12:33 PM
Updated by:
 
Contributors