Importing code from Git in project libraries

If you have code that has been developed outside of DSS and is available in a Git repository (for example, a library created by another team), you can import this repository (or a part of it) in the project libraries, and use it in any code capability of DSS (recipes, notebooks, webapps, …)

In the project libraries, you can import multiple external repositories, and declare which parts of said repositories should be treated as being part of the project source paths.

This mechanism is called “Git references”.

Importing a new repository

  • Go to the project’s library editor
  • Click Git > Import from Git
  • Enter the URL of the Git repository. Optionally, enter a branch name, tag name or commit id to import
  • Optionally, enter a subpath if you only want to import a part of the repository
  • Enter the “Target path”: where in the hierarchy of libraries you want to import this repository

When you click Save and Retrieve, the repository is fetched.

For more details on working with Git remotes, see Working with Git

Working with Git references

Once the repository is retrieved, it is an isolated snapshot: you cannot push modifications to the original repository.

While you can perform modifications to the files in DSS, we. don’t recommend that you do because the next time you update the Git reference, these changes will be lost.

To update a reference, either use:

  • Git > Manage Git references > Update
  • Right-click on the root path of the Git reference and click “Update from Git”

Once the repository has been retrieved, it can be imported in Python and R code. See reusing Python code and reusing R code.