Tutorial | Plugin version management with Git#

After developing a Dataiku plugin on your instance, you can manage versions of the plugin on a remote Git repository (e.g., GitHub). This makes it possible to share the plugin across multiple Dataiku instances, and to allow users on those other instances to contribute updates to the plugin.

In this tutorial, you will learn how to:

  • Version your plugins with development branches.

  • Track the history of development.

  • Connect to a remote Git repository.

Prerequisites#

  • You should work through the Plugins course in order to have a locally developed plugin.

  • Familiarity with the basics of Git

Technical requirements#

Connect to a remote Git repository#

Open the plugin you created in the Plugins course.

In order to share development of this plugin with other coders, we need to connect to a remote Git repository (repo).

  1. Click on the change tracking indicator and select Add a remote.

  2. Enter the URL of the remote and click OK.

  3. If the master branch on the remote Git repo has any commits ahead of the local master branch, Pull those changes. This will be necessary if the repo you’re connecting to is not empty.

  4. From the change tracking indicator, select Push.

../../_images/plugin-remote.png

In your remote Git repo, you can see that the master branch has been successfully pushed.

../../_images/plugin-push.png

Note

We recommend using a separate repository for each plugin.

Git versioning#

Now we’d like to work on changes to the plugin, using a development branch so that other people can continue using the original plugin.

  1. From the branch indicator, click Create new branch.

  2. Name the new branch library and click Create.

    ../../_images/plugin-branch.png

    This creates a new development branch of the plugin off of the master branch.

Now let’s make some changes:

  1. Under the first-plugin folder, create a new folder called python-lib.

  2. Under the python-lib folder, create a new file called compute_corr.py.

  3. Cut the definitions of the functions compute_pairs() and compute_corr() from recipe.py and paste them into compute_corr.py.

  4. Add the line import pandas as pd, numpy as np to the top of compute_corr.py.

  5. Add the line from compute_corr import * to the top of recipe.py.

    ../../_images/plugin-library.png
  6. Click on the History tab to see the changes you’ve made on this branch. If you switch to the master branch, you’ll see that the history only has the original development to the plugin, and none of the changes we’ve made to the branch.

    ../../_images/plugin-history.png
  7. Switch back to the library branch.

  8. From the change tracking indicator, select Push.

    You can see the library branch has been pushed to your remote Git repo. In order to merge the changes with the master branch, do that in the normal way outside of Dataiku.

    ../../_images/plugin-merge.png
  9. To see the merges reflected in Dataiku, first Fetch the changes from the remote Git repo and then Pull the changes to your local Git.

../../_images/plugin-pull.png